combining binary images with masks

Discussion related to "under the hood" OpenMV topics.
Posts: 7
Joined: Sat Oct 27, 2018 10:47 am

combining binary images with masks

Postby mmmarouen » Fri Nov 02, 2018 8:39 pm


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 :D
Any ideas please?

Code: Select all

imbin = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)
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,
User avatar
Posts: 3109
Joined: Sun May 24, 2015 2:10 pm

Re: combining binary images with masks

Postby kwagyeman » Sat Nov 03, 2018 1:45 pm

Thresholds is not a keyword argument. Remove the keyword "thresholds=".

Return to “Technical Discussion”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests