Plotting coordinates of object boundaries over x,y-sytem

1 次查看(过去 30 天)
I have the segmented image of 8 sprays. I want to extract the boundary of each sprays and plot it over a x,y-system with the main axis of the spray as the positive x-axis. As a result I want to have 8 plots of 8 sprays.

回答(1 个)

Vishal Bhutani
Vishal Bhutani 2018-9-3
By my understanding you want to plot 8 sprays in 8 different figures. You can find the attached code for extracting boundaries from sprays and plot in different figures.
clc
clear all
close all
%bsp image
i = imread('bsp.jpg');
figure
imshow(i);
bw = imbinarize(i);
x = bwboundaries(bw);
%To plot all the sprays on single figure
figure
for k = 1:length(x)
boundary = x{k};
plot(boundary(:,2), boundary(:,1));
hold on;
end
%To plot 8 sprays on 8 figures
hold off;
for k = 1:length(x)
figure
boundary = x{k};
plot(boundary(:,2), boundary(:,1));
end
Hope it helps.

类别

Help CenterFile Exchange 中查找有关 Signal Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by