How to find four coordinates of inner rectangle?

2 Ansichten (letzte 30 Tage)
Ashwathy Dev
Ashwathy Dev am 3 Feb. 2015
Kommentiert: Image Analyst am 4 Feb. 2015
How to find the four inner coordinates of the white rectangle in matlab?

Akzeptierte Antwort

Michael Haderlein
Michael Haderlein am 3 Feb. 2015
Bearbeitet: Michael Haderlein am 3 Feb. 2015
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');
  6 Kommentare
Image Analyst
Image Analyst am 4 Feb. 2015
Michael's reply moved from Ashwathyu's "Answer" to here:
So is the question still open? What exactly do you need anymore? If my answer doesn't work/fit/suffice, please tell us what exactly is the problem. If my answer is fine, please mark it as accepted. This way, nobody will waste time reading through questions which have already been answered.
Thanks!
Image Analyst
Image Analyst am 4 Feb. 2015
Michael, your top/bottom is correct - nothing to switch/reverse. For images, like arrays, the top line is 1 and increases from there, so your formula for top will give the correct line (row) number.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by