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

How to find area & coordinates of white pixels in binary image?

2 comentarios

Attach image....have a look on find, regionprops.
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
Editada: Image Analyst el 26 de Dic. de 2024
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);

Categorías

Más información sobre Images en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 6 de Nov. de 2018

Editada:

el 26 de Dic. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by