Plotting coordinates of object boundaries over x,y-sytem
2 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Vishal Bhutani
on 3 Sep 2018
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.
0 Comments
See Also
Categories
Find more on Data Exploration in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!