MATLAB: How to find “rectangular” corners

cornersimage processingImage Processing Toolboxpgoncorners

Hey,
I have this image:
I want to find the 4 corners of the "rectangular", but I don't want to use the "corner" function. What can I do?
Thanks.

Best Answer

If the quadrilateral is roughly aligned with the edges of the image, you could also find the corners as follows,
[I,J]=find(Image>max(Image(:))/2);
IJ=[I,J];
[~,idx]=min(IJ*[1 1; -1 -1; 1 -1; -1 1].');
corners=IJ(idx,:)
Related Question