Area under the plot
Afficher commentaires plus anciens
Hello,
I have an image where I have plotted the boundaries with green color. I want to know the area under the green colored plot. Could someone help me with a matlab code?
I have attached my sample image and the green boundary plotted image with my code too.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
close all;
clc;
I = imread('sample.png');
I_gray = im2gray(I);
I_bin = imbinarize(I_gray);
I_rev = imclearborder(I_bin);
B = bwboundaries(I_rev);
figure()
imshow(I_gray)
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'g', 'LineWidth', 0.6)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!