How to find four coordinates of inner rectangle?

조회 수: 5 (최근 30일)
Ashwathy Dev
Ashwathy Dev 2015년 2월 3일
댓글: Image Analyst 2015년 2월 4일
How to find the four inner coordinates of the white rectangle in matlab?

채택된 답변

Michael Haderlein
Michael Haderlein 2015년 2월 3일
편집: Michael Haderlein 2015년 2월 3일
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
Image Analyst
Image Analyst 2015년 2월 4일
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 2015년 2월 4일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by