Area under the plot

5 次查看(过去 30 天)
Divya Kumar
Divya Kumar 2024-3-23
编辑: Matt J 2024-3-24
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

采纳的回答

Matt J
Matt J 2024-3-24
编辑:Matt J 2024-3-24

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by