Fixed sensor settings

Discussion related to "under the hood" OpenMV topics.
GregR
Posts: 9
Joined: Thu Sep 14, 2017 12:23 am

Fixed sensor settings

Postby GregR » Sat Sep 23, 2017 8:09 pm

My application involves inspecting a mostly white object that is placed in a black jig for inspection.
There may or may not be an object in the jig at power up.
I am currently setting the exposure, gain, and white balance but I still see variance.
My test is to check the average brightness of a small white patch that is always in the field of view.
If the object is not present at power up the field is very dark and the patch ends up at about 150.
When the object is present at power up the patch end up at about 120.
What am I missing?

Code: Select all

sensor.reset()                          # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE)  # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(20)                  # Wait for settings take effect.
sensor.set_auto_exposure(False,value=250)
sensor.set_auto_gain(False,value=50)
sensor.set_auto_whitebal(False, value =(50,50,50))
sensor.set_windowing((0, 250, 640, 50))
Regards,

Greg
User avatar
kwagyeman
Posts: 1175
Joined: Sun May 24, 2015 2:10 pm

Re: Fixed sensor settings

Postby kwagyeman » Sat Sep 23, 2017 10:54 pm

Turn autogain and autowhite balance off after startup. As for the variance... welcome to color tracking. Settings will always move around. The camera never produces a consistent output. It's best to use gradients to track if something is in the image.

Can you look at the edges of the image first to get an idea of the color and then compare that with the middle? Maybe a split the image up into 9 parts... 3x3 boxes, look at the colors in each box and check if the middle is not consistent with the rest?
Nyamekye,
User avatar
kwagyeman
Posts: 1175
Joined: Sun May 24, 2015 2:10 pm

Re: Fixed sensor settings

Postby kwagyeman » Sat Sep 23, 2017 10:56 pm

As for checking the image... do, img.get_statistics(). This methods will average the colors in the image given a region of interest for you. You can find the method to use here: http://docs.openmv.io/library/omv.image ... statistics.
Nyamekye,
GregR
Posts: 9
Joined: Thu Sep 14, 2017 12:23 am

Re: Fixed sensor settings

Postby GregR » Mon Sep 25, 2017 3:20 pm

Hi kwagyeman,
Thanks for the quick response.
What is the mechanism at play here? Is it just not possible to get to the necessary registers? The effect I'm seeing isn't drift or anything like that. I can repeat it with no problems. It seems like some kind of auto setup that doesn't get overwritten by the values I'm setting.

Regards,

Greg

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest