Advertisement
Guest User

Untitled

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