Get the spatial coordinates for the outer boundary from pixels

2 Ansichten (letzte 30 Tage)
Muhammad Saafan
Muhammad Saafan am 7 Sep. 2019
Beantwortet: Mahesh Taparia am 18 Sep. 2019
I have the boundaries in pixels (row, col). How to get the black boundary in spatial coordinates?
For example, consider the pixel give by [2,1] as the starting pixel. I want to extract the boundaries given by black line to be:
[1.5 , 0.5;
2.5, 0.5;
3.5, 0.5
3.5, 1.5;
4.5, 1.5;
5.5, 1.5;
5.5, 2.5;
6.5, 2.5;
6.5; 1.5;
........]
Untitled.png

Antworten (1)

Mahesh Taparia
Mahesh Taparia am 18 Sep. 2019
Hi Muhammad,
As per your question, I understand that you want to make a black boundary at some spatial coordinates. Since you already have the boundary coordinates, you can do by setting the following condition to each coordinates by taking a loop over all points (x,y):
image(x,y,:)=[0 0 0]; %%[0 0 0] corresponds to black in RGB color space.
Also, as per your example, you want to extract the coordinates of black boundary in an image. You can do by using the following command
[x y]=find(image==0);
Hope it will help.

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by