Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- building=imread('C:\Users\Tatjana\Downloads\building.tif');
- h=fspecial('average',3);
- bs=imfilter(building,h);
- b_c = edge(bs,'Canny',0.2);
- figure;imshow(b_c,[]);
- bw2=bwmorph(b_c,'dilate');
- figure;imshow(bw2);
- cropped=imcrop(bw2,[4 4 593 593]);
- figure;imshow(cropped);
- [H,T,R] = hough(cropped,'RhoResolution',1,'Theta',-90:0.125:89.875);
- rabovi = houghpeaks( H, 25, 'NHoodSize', [17 17] );
- linii = houghlines(cropped,T,R,rabovi,'FillGap',15,'MinLength',28);
- figure;imshow(H,[]);
- figure;imshow(cropped,[]); hold on;
- for k = 1:length(linii)
- xy = [linii(k).point1; linii(k).point2];
- plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement