Plotting coordinates of object boundaries over x,y-sytem

조회 수: 2 (최근 30일)
Thuy Dung Nguyen
Thuy Dung Nguyen 2018년 8월 29일
답변: Vishal Bhutani 2018년 9월 3일
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에서 Data Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by