combining binary images with masks

Hello,

When applying img**.binary** I receive the error message: “TypeError: function missing 1 required positional arguments”
This probably due to either incorrect usage of the binary function or the masks or both :smiley:
Any ideas please?

imbin = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)
imbin.replace(sensor.snapshot())
while(pyb.elapsed_millis(start) < record_time):
    img = sensor.snapshot().histeq() 
    imbin.clear() #reset the mask
    blobs = img.find_blobs([thresholds[threshold_index]], roi=roi, merge=False) 
    if blobs:
        most_pixels = 0
        largest_blob = 0
        for i in range(len(blobs)):
            if blobs[i].pixels() > most_pixels:
                most_pixels = blobs[i].pixels()
                largest_blob = i
        imbin.draw_rectangle(blobs[largest_blob].rect(),color=(255,255,255),fill=True).to_bitmap() #update mask with the found blob
        img.binary(thresholds=[thresholds[threshold_index]],mask=imbin) #here's where I get the error code

Thanks for support,
Marouen

Thresholds is not a keyword argument. Remove the keyword “thresholds=”.