質問編集履歴
3
画像の再記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -82,8 +82,6 @@
|
|
82
82
|
|
83
83
|
### 補足情報(FW/ツールのバージョンなど)
|
84
84
|
|
85
|
-
使用した画像
|
85
|
+
使用した画像
|
86
86
|
|
87
|
-
![イメージ説明](afcfbdede6b6704e594a2fc4764bdab2.jpeg)
|
88
|
-
|
89
|
-
![
|
87
|
+
![使用した画像(グレースケール)](03bdcfc4f61d49deeb61d414a49624bc.jpeg)
|
2
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,11 @@
|
|
28
28
|
|
29
29
|
ソースコード
|
30
30
|
|
31
|
+
gray1 = imread('######');
|
32
|
+
|
33
|
+
binary1 = imbinarize(gray1);
|
34
|
+
|
31
|
-
edge1 = edge(
|
35
|
+
edge1 = edge(binary1,'Canny');
|
32
36
|
|
33
37
|
%%%%%バイナリ画像膨張%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
34
38
|
|
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,6 +30,16 @@
|
|
30
30
|
|
31
31
|
edge1 = edge(gray1,'Canny');
|
32
32
|
|
33
|
+
%%%%%バイナリ画像膨張%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
34
|
+
|
35
|
+
se90 = strel('line',12,90); se0 = strel('line',12,0); %縦方向、横方向に12ピクセル
|
36
|
+
|
37
|
+
edge1 = imdilate(edge1,[se90 se0]);
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
%%%%%ハフ変換%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
42
|
+
|
33
43
|
[H,T,R] = hough(edge1);
|
34
44
|
|
35
45
|
P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:)))); %ピークの検出
|
@@ -43,6 +53,8 @@
|
|
43
53
|
for k = 1:length(lines)
|
44
54
|
|
45
55
|
xyAtoZ = [lines(k).point1; lines(k).point2]; % xyAtoZ(2,1)は終点のx座標、xyAtoZ(1,2)は始点のy座標
|
56
|
+
|
57
|
+
|
46
58
|
|
47
59
|
plot(xyAtoZ(:,1),xyAtoZ(:,2),'LineWidth',2,'Color','green');
|
48
60
|
|