Changeset 663
- Timestamp:
- 02/10/10 22:02:57 (2 years ago)
- Location:
- branches/2010-image-rec
- Files:
-
- 2 modified
-
hist_test.asv (modified) (2 diffs)
-
hist_test.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2010-image-rec/hist_test.asv
r662 r663 106 106 mask = imclose(mask, se); 107 107 108 textureactual=texture;109 for threshold = . 3:.02:.5110 texture(textureactual> threshold & mask == 0) = 1;111 texture(texture ~= 1) = 0;112 imtool( texture);108 line_mask = texture; 109 for threshold = .42 110 line_mask(texture > threshold & mask == 0) = 1; 111 line_mask(texture <= threshold | mask ~= 0) = 0; 112 imtool(line_mask); 113 113 end 114 114 … … 124 124 line([left_x right_x right_x left_x left_x], ... 125 125 [top_y top_y bottom_y bottom_y top_y]); 126 127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 128 129 figure(3); 130 131 [H,T,R] = hough(line_mask); 132 imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit'); 133 xlabel('\theta'), ylabel('\rho'); 134 axis on, axis normal, hold on; 135 P = houghpeaks(H,5,'NHoodSize',[161,161])%ceil(0.3*max(H(:)))); 136 x = T(P(:,2)); 137 y = R(P(:,1)); 138 plot(x,y,'s','color','white'); 139 140 lines = houghlines(line_mask,T,R,P,'FillGap',5,'MinLength',7); 141 figure, imshow(im_rgb), hold on 142 max_len = 0; 143 for k = 1:length(lines) 144 xy = [lines(k).point1; lines(k).point2]; 145 plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','blue'); 146 147 % plot beginnings and ends of lines 148 plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); 149 plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red'); 150 151 % determine the endpoints of the longest line segment 152 len = norm(lines(k).point1 - lines(k).point2); 153 if ( len > max_len) 154 max_len = len; 155 xy_long = xy; 156 end 157 end 158 159 % highlight the longest line segment 160 plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan'); 161 162 163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 126 164 127 165 fprintf('Done\n'); -
branches/2010-image-rec/hist_test.m
r661 r663 127 127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 128 128 129 figure(3); 130 129 131 [H,T,R] = hough(line_mask); 130 132 imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit'); … … 141 143 for k = 1:length(lines) 142 144 xy = [lines(k).point1; lines(k).point2]; 143 plot(xy(:,1),xy(:,2),'LineWidth',2,'Color',' green');145 plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','blue'); 144 146 145 147 % plot beginnings and ends of lines

