why different answers with roipoly and polyarea

clear all close all
nrows=300; ncols=400; N=4; % number of vertices
ang=0:360/N:360; ang=ang+45; radius=min(nrows,ncols)/2; h=ncols/2+radius*cosd(ang); v=nrows/2+radius*sind(ang);
im=zeros(nrows,ncols); im=roipoly(im,h,v); area=sum(sum(im)) area2=polyarea(h,v)

답변 (1개)

Sachin Ganjare
Sachin Ganjare 2012년 10월 18일

0 개 추천

'roipoly' is used to get manually the region of interest
'polyarea' is used to calculate the ROI area
Example:
% imshow first, then:
[x, y, BW, xi, yi] = roipoly;
area = polyarea(xi,yi);
Hope it helps!!!

이 질문은 마감되었습니다.

질문:

2012년 10월 18일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by