Sir, how to find area & coordinates of white pixels in binary image?

5 visualizaciones (últimos 30 días)
hemanth kumar.v
hemanth kumar.v el 6 de Nov. de 2018
Editada: Image Analyst el 26 de Dic. de 2024 a las 20:13
How to find area & coordinates of white pixels in binary image?
  2 comentarios
KSSV
KSSV el 6 de Nov. de 2018
Attach image....have a look on find, regionprops.
hemanth kumar.v
hemanth kumar.v el 6 de Nov. de 2018
I wanted to crop those white pixels & i did with the help of find function.. thanks sir

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 26 de Dic. de 2024 a las 20:12
Editada: Image Analyst el 26 de Dic. de 2024 a las 20:13
To get all the rows and columns of the white pixels, you can do
[rows, columns] = find(binaryImage);
You'll get two vectors and a given index will give you the same pixel. For example to get the row and column of the 37th pixel, you can do
r = rows(37)
c = columns(37)
If you want to use x,y terminology, you can do
[y, x] = find(binaryImage);
because rows are y and columns are x.
To crop you can do
row1 = min(rows);
row2 = max(rows);
col1 = min(columns);
col2 = max(columns);
binaryImage = binaryImage(row1:row2, col1:col2);

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by