Clear Filters
Clear Filters

Plotting coordinates of object boundaries over x,y-sytem

2 views (last 30 days)
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.

Answers (1)

Vishal Bhutani
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.

Categories

Find more on Data Exploration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!