What does blobs.pixels() return ?

Discussion related to "under the hood" OpenMV topics.
rakshak
Posts: 1
Joined: Thu Sep 19, 2019 2:33 am

What does blobs.pixels() return ?

Postby rakshak » Fri Sep 20, 2019 1:32 am

I am trying to find the number of pixels of a certain colour in a frame. I am using the following code for this;

Code: Select all

blobs = img.find_blobs([brown_lab_threshold], merge=True)
    if blobs:
        for b in blobs:
            count = count + b.pixels()
Here is my question, does blob.pixels() return all the pixels within the upper and lower limits of the blob or does it only return the number of pixels in the blob that are of the colour that I am looking for?

The upper and lower limits form a rectangle and my blobs are rarely a regular shape, they tend to be curvy (:P) so there are bound to be a bunch pixel of a colour I don't care about within the upper and lower limit.

If blob.pixels() return every pixel in the upper and lower limits, how do I get an exact count of the number of pixels if a certain colour in an image?
User avatar
iabdalkader
Posts: 1142
Joined: Sun May 24, 2015 3:53 pm

Re: What does blobs.pixels() return ?

Postby iabdalkader » Fri Sep 20, 2019 7:04 am

User avatar
kwagyeman
Posts: 3829
Joined: Sun May 24, 2015 2:10 pm

Re: What does blobs.pixels() return ?

Postby kwagyeman » Fri Sep 20, 2019 1:23 pm

Its the number of pixels in the blob. It's not related to the area of the bounding rectangle of the blob.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests