Exclude portion of image?

OpenMV related project discussion.
Chris19
Posts: 19
Joined: Tue Apr 23, 2019 5:28 pm

Exclude portion of image?

Postby Chris19 » Sat May 11, 2019 7:20 am

Love our H7's, they are truly fantastic.

They are working great to find colored objects - now in windowed 640x480 thanks to your advice >>>

Code: Select all

sensor.set_windowing((100,0,420,480)) 
We're trying to optimize the fps by excluding a region in the center of the image that will never change from the image.find_blobs call.

Something like an inverted ROI would be perfect - and it appears that the image.mask_rectangle/mask_circle/mask_ellipse functions might appear to help. However, when we test with these, they perform the exact OPPOSITE function - excluding everything not in the mask.

Can you suggest any options?

Thanks,
User avatar
iabdalkader
Posts: 920
Joined: Sun May 24, 2015 3:53 pm

Re: Exclude portion of image?

Postby iabdalkader » Sat May 11, 2019 9:09 am

Yes that's what mask functions do they mask everything except the shape. Maybe you need to draw a filled object ? Try draw_rectangle(...., fill=True)
http://docs.openmv.io/library/omv.image ... _rectangle
Chris19
Posts: 19
Joined: Tue Apr 23, 2019 5:28 pm

Re: Exclude portion of image?

Postby Chris19 » Sat May 11, 2019 9:44 am

WOW! You are amazing and appreciated with the lighting fast response!

Running this code snippet we get the following image in the IDE. The entire image is black except for the area we want to mask out, which is exactly the opposite of what we're looking for.

Any advice on what we're doing wrong is appreciated!

Code: Select all

while(True):
    clock.tick()
    sensor.set_windowing((WindowStartX,WindowStartY,WindowSizeX,WindowSizeY))
    img = sensor.snapshot() 
    img.mask_circle(150,150,50)

    for blob in img.find_blobs(thresholds, pixels_threshold=25, area_threshold=25):
Also tried the following with the same result

Code: Select all

while(True):
    clock.tick()
    sensor.set_windowing((WindowStartX,WindowStartY,WindowSizeX,WindowSizeY))
    img = sensor.snapshot() 

    for blob in img.mask_circle(150,150,50).find_blobs(thresholds, pixels_threshold=25, area_threshold=25):
Mask.png
Mask.png (16.12 KiB) Viewed 4983 times
User avatar
iabdalkader
Posts: 920
Joined: Sun May 24, 2015 3:53 pm

Re: Exclude portion of image?

Postby iabdalkader » Sat May 11, 2019 9:49 am

I answered your question already, try draw_circle with fill = True:

Code: Select all

img.draw_circle(img.width()//2, img.height()//2, 100, (0, 0, 0), fill=True)
Also please see the docs:

http://docs.openmv.io/library/omv.image ... raw_circle
Chris19
Posts: 19
Joined: Tue Apr 23, 2019 5:28 pm

Re: Exclude portion of image?

Postby Chris19 » Sat May 11, 2019 9:55 am

Thanks! That makes sense and was far too easy :D

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 61 guests