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)

Antworten (1)

Sachin Ganjare
Sachin Ganjare am 18 Okt. 2012

0 Stimmen

'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!!!

Diese Frage ist geschlossen.

Gefragt:

am 18 Okt. 2012

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by