# White Pixel Count

**URL:** <https://forums.openmv.io/t/white-pixel-count/671>\
**Category:** OpenMV Boards\
**Created:** [May 2, 2018, 2:02pm UTC](https://forums.openmv.io/t/white-pixel-count/671 "2018-05-02T14:02:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_H](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@Tim\_H](https://forums.openmv.io/u/Tim_H)\
**Post date:** [May 2, 2018, 2:02pm UTC](https://forums.openmv.io/t/white-pixel-count/671/1 "2018-05-02T14:02:42Z")

</div>

I have a Project at the moment while i want to count the amount of White Pixels in a Picture. I found nothing in the Forum and the Helps where i can see more Deatails of a Picture.  
Is there any Solution to get a Integer number of how many Pixel are white in the Pixture and how many aren’t?

Best Regards

Tim Hochstein

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 3, 2018, 3:16am UTC](https://forums.openmv.io/t/white-pixel-count/671/2 "2018-05-03T03:16:46Z")

</div>

Yes, use find\_blobs(), set the color thresholds to pure white. Then sum up all the pixels() values from each blob returned:

```python
count = sum(map(lambda x: x.pixels(), img.find_blobs([(100, 100)])))

```

For RGB565

```python
count = sum(map(lambda x: x.pixels(), img.find_blobs([(255, 255)])))

```

For GRAYSCALE

---

<div class="post-metadata">

**Author:** ![Tim\_H](https://avatars.discourse-cdn.com/v4/letter/t/f17d59/32.png) [@Tim\_H](https://forums.openmv.io/u/Tim_H)\
**Post date:** [May 24, 2018, 7:24am UTC](https://forums.openmv.io/t/white-pixel-count/671/3 "2018-05-24T07:24:12Z")

</div>

Yeah perfect works fine. Thats a smart idea. With the find\_blobs function.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [May 24, 2018, 5:42pm UTC](https://forums.openmv.io/t/white-pixel-count/671/4 "2018-05-24T17:42:56Z")

</div>

Note find\_blobs() expects a min blob size and area and will filter out white pixel outlier blobs. If you want all pixels then you need to tweak the parameters.
