how to have standard focus

Iam using the multy_color traking example
I use two colors one the yellow of UHU glou bottle and I have a red tape in the midle
I am traking the yellow and the red tape

the problem is that every time i start the program if the camera look on the door ( have plenty light) it cannot recognize the colors
if the camera look inside the room then I can track the colors

is there any way that i can start the porgram and i must not turn the camera to the door or into the room
also if the light is different then I must recapture the color from the ide panel

Color tracking has a limitation that the lighting not change. Whatever the camera autogains to is what you need to track for.

Via register settings you can force the camera back to certain gains, however, this won’t account for changes in the scene. We don’t have a nice automated approach for this right now. You’ll have to manually look at colors and compare with the data sheet for the camera sensor.

Alternatively, you can relax your color bounds. This should work.

Sorry if the above answers aren’t really satisfaction. Color tracking requires the lighting to be basically constant.

Note that to deal with color shifts you can… If you want… Turn off auto white balance earlier than after 2 seconds. This will stop that from happening at all and make colors more stable… But, will result in not optimal settings.