Borrar filtros
Borrar filtros

bwarea & area, white/black ratio

8 visualizaciones (últimos 30 días)
dan kin
dan kin el 3 de Oct. de 2012
Comentada: Image Analyst el 22 de Dic. de 2017
Hi,
Can someone please explain me what is the difference of bwarea & area.
I have an image which is black and white (after segmentation and fill) & I wish to calculate the area of an object (as I understand done by bwarea) relative to the image area (imageArea = regionprops(image_name, 'Area')), more or less calculating the white/black ratio.
Any other ideas is welcome.
Thanks.

Respuesta aceptada

Image Analyst
Image Analyst el 3 de Oct. de 2012
Editada: Image Analyst el 3 de Oct. de 2012
They use different algorithms. regionprops gives the number of pixels while bwarea gives some kind of weighted area that depends on the shape of the boundary. This is described in the documentation for bwarea
The white to black ratio is
totalPixels = numel(binaryImages);
numWhitePixels = sum(binaryImage(:));
numBlackPixels = totalPixels - numWhitePixels;
ratio = numWhitePixels / numBlackPixels;

Más respuestas (1)

dan kin
dan kin el 3 de Oct. de 2012
Hi,
Therefore, bwarea/area is not like white/black ratio. Am I correct?
If this is the case how do I solve it, built in function?
Thx
  3 comentarios
shivam sahil
shivam sahil el 21 de Dic. de 2017
Hey! I want to implement the same code for RGB to get pixel count of particular rgb index, please guide me with the code for the same.
Image Analyst
Image Analyst el 22 de Dic. de 2017
See attached demo. Also see the function colorcloud().

Iniciar sesión para comentar.

Categorías

Más información sobre Visual Exploration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by