Borrar filtros
Borrar filtros

How can I count the pixels in a black and white image?

2 visualizaciones (últimos 30 días)
Mara Pereira
Mara Pereira el 8 de Jul. de 2020
Respondida: Image Analyst el 8 de Jul. de 2020
How can I count the pixels in a black and white image?

Respuestas (1)

Image Analyst
Image Analyst el 8 de Jul. de 2020
Try this:
numberOfPixels = numel(binaryImage)
numberOfWhitePixels = nnz(binaryImage)
numberOfBlackPixels = numberOfPixels - numberOfWhitePixels

Community Treasure Hunt

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

Start Hunting!

Translated by