Statistics or Histogram of Blob

I have a project similar to "Using OpenMV as a bean sorter.
I have a stream of objects going past and I want to use OpenMV to select which objects fall outside Lab or Histogram sort criteria.
I am a total beginner at OpenMV but using the examples I have code working that will see and track the objects goings past. The idea is that I get the Statistics data or the Histogram data from the Blob, rather than the entire image. This way I should be able to eliminate the “diluting” influence of the background.
I am struggling to find how to return the colour data from the Blob.
Can someone please give me the correct Syntax to return the Blob Statistics or Histogram.

Hi, so, just use the rect() method from the blob and feed that to the ROI parameter of get_statistics.


Stats = img.get_statistics(roi=blob.rect())

That achieved exactly what I wanted.
I can now use
if (stats[0] < 60): #or some other Lab criteria
print(“Colour difference detected…”)

In my quick test it worked perfectly and made the discrimination much more sensitive.