how to find the number of pixels in the white region of a binary image
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to get the number of pixels o the white area in the given binary image. is there any code available to know tha same. The ultimate need is to find the area of the region by multiplying number of pixels with area of one pixel![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1053655/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1053655/image.png)
0 Commenti
Risposte (2)
Raghav
il 3 Lug 2022
Modificato: Jan
il 3 Lug 2022
Hi @Rah Ul
As white pixels have a value=1 (and black pixels' value=0), doing sum of pixel values can return the total number of white pixels in the binary image. If Image is stored in "Im", you can write the expression:
WhiteNum=sum(Im(:));
If you want to find the area of object formed by white pixels, use the function - bwarea().
To understand more about bwarea(), refer to the link that I am attaching below:
0 Commenti
Vedere anche
Categorie
Scopri di più su Computer Vision with Simulink in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!