Differentiating blob size

Hello there.

If I have two same colored blobs, how can I detecting which one is bigger and send it’s data(x,y width, height) to an arduino so it can be processed by my robot.

Have a nice day, Andrija.

Hopefully I can help you here.

something like this should find the biggest rect blob

img = sensor.snapshot()
biggest = [0,0,0,0]
for blob in img.find_blobs([threshold], pixels_threshold=100, area_threshold=100, merge=True, margin=10):
   current = blob.rect()
   if current[2] * current[3] > biggest[2] * biggest[3]: biggest = current

I would image the easiest way to send this data to the Ardunio would be via UART and you would have serialize the data as a stream of 4 unsigned short int like this

from ustruct import pack
packed_data = pack('HHHH', biggest)