How to find the coordinates of the white square ?

1 view (last 30 days)

Accepted Answer

Matt J
Matt J on 20 Feb 2019
Edited: Matt J on 20 Feb 2019
Some simple morphological operations are all you need.
A=imbinarize((imread('image.jpeg')));
A=bwareafilt( imopen(A,strel('disk',5)) ,1);
[I,J] = find(A); %The desired coordinates??
imshow(A)
  4 Comments
Matt J
Matt J on 21 Feb 2019
Edited: Matt J on 21 Feb 2019
A is the image, as displayed above, with everything but the square removed. I and J are the matrix coordinates of the non-zero pixels of A, see FIND.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!