Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I = imread('F:h.png');
- info = imfinfo('F:h.png');
- I1 = ~im2bw(I);
- I2 = bwlabel(I1);
- S = regionprops(I2, {'BoundingBox'});
- [m,n] = size(S);
- for a=1:m
- for b=1:n
- width = S(a,b).BoundingBox(3);
- height = S(a,b).BoundingBox(4);
- if width==height
- display('square');
- else
- display('rectangle');
- end
- display(width);
- display(height);
- pause(2)
- end
- end
- I = imread('F:h.png');
- info = imfinfo('F:h.png');
- I1 = ~im2bw(I);
- I2 = bwlabel(I1);
- S = regionprops(I2, {'BoundingBox'});
- [m,n] = size(S);
- for a=1:m
- for b=1:n
- width = S(a,b).BoundingBox(3);
- height = S(a,b).BoundingBox(4);
- if width==height
- display('square');
- text(S(a,b).Centroid, 'square')
- else
- display('rectangle');
- text(S(a,b).Centroid, 'rectangle')
- end
- display(width);
- display(height);
- pause(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement