Filter löschen
Filter löschen

Plotting coordinates of object boundaries over x,y-sytem

2 Ansichten (letzte 30 Tage)
Thuy Dung Nguyen
Thuy Dung Nguyen am 29 Aug. 2018
Beantwortet: Vishal Bhutani am 3 Sep. 2018
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.

Antworten (1)

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

Kategorien

Mehr zu Data Exploration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by