Area under the plot

7 visualizaciones (últimos 30 días)
Divya Kumar
Divya Kumar el 23 de Mzo. de 2024
Editada: Matt J el 24 de Mzo. de 2024
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Respuesta aceptada

Matt J
Matt J el 24 de Mzo. de 2024
Editada: Matt J el 24 de Mzo. de 2024
bwarea(I_rev)

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by