MATLAB: How to find four coordinates of inner rectangle

digital image processingimage processinglicense platelpr

How to find the four inner coordinates of the white rectangle in matlab?

Best Answer

vsum=sum(image,1);
hsum=sum(image,2);
top=find(vsum,1,'first');
bottom=find(vsum,1,'last');
left=find(hsum,1,'first');
right=find(hsum,1,'last');