Get color channel data for each blob

I am using find_blobs to detect and log blobs:

img.find_blobs([(0, 3), (-3, 3),(-3, 3)],invert = True, merge = True, pixels_threshold = 100)

Apart from the usual statistics like elongation, number of pixels, etc. I would like to extract statistics about the Lab color channels. I was thinking that I should set the x_ or y_hist_bis_max to some integer value above 0 but then I do not know how to access that information (I tried calling “histogram()” on the blob, or accessing its blob.x_histogram() attribute, etc.).

You just do: image — machine vision — MicroPython 1.15 documentation

The histogram is a list of integers.

thanks! I did not check properly it seems, and now I got it to work and output the list of integers.
However: would this be a histogram of the “L” channel in Lab space? How do I get the info for each color channel?

No, it’s a histogram of the binary mask of the object. It’s meant to be a descriptor that you can use to match binary patterns.

You want to use get_histogram() with the roi= and threshold= arguments set on a blob location to get the histogram of the color channels.

1 Like

Thanks Kwabena, you set me on the right path! Following the documentaiton, I then used get_statistics() with the roi = blob.rect and thresholds equal to the same values that I use in find.blobs() to get the LAB channels’ mode, min, and max values.