Sir, how to find area & coordinates of white pixels in binary image?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
Respuestas (1)
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);
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!