Matlab area calculation -


if have arbitrary shape (attached simple mock up), how estimate area of enclosed surface in matlab. random points along curve, used ginput command rough estimate of curve, unequal spacing between points. want estimate of area, believe trapz command overestimate area due overlap (please correct me if wrong here). there more accurate way obtain area?

thanks! enter image description here

enter image description here

well, didn't give enough info solve problem entirely, here's 1 approach can take find boundary automatically in order calculate area:

% image , convert logical mask img = ~im2bw(imread('polyarea.jpg'));  % fill hole img = imfill(img,'holes');  % boundary b = bwboundaries(img);  % approximate area of boundary area = polyarea(b{1}(:,1), b{1}(:,2));  % print area disp(['area: ' num2str(area)]);   imshow(img); hold on; plot(b{1}(:,2),b{1}(:,1),'go'); 

the idea have input, form logical mask, boundary of mask, , can approximate area enclosed boundary using polyarea.

the output is:

enter image description here

area: 228003 

additionally, use regionprops(img,'area') outputs:

ans =       area: 229154 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

python - Scapy Dot11ReassoReq -