Page 1 of 1

### Trigger on background color change

Posted: Sat Dec 08, 2018 11:13 am
Hi all

I use the cam to detect a moving object passing in front of a black background.
Light seems to affect my trigger using l_ mean from image statistics only
Something like :

Img.capture
St=ing.statistics
while st.l_ mean > 19:
Do Analyse object.....
Img.capture
St=ing.statistics

What is the best way to eliminate small light differences so the trigger becomes more' stable'
So more like get the colour from image statistics regardless lighter or darker?

So if capture 1 one is at say x light and capture 2 is at x-1 Light
How you calculate capture 2 back to one?

Kind regards

### Re: Trigger on background color change

Posted: Sat Dec 08, 2018 11:05 pm
Hi, you have to expect there will be some noise in the system and that you can't eliminate it. However, you can always compare the difference in brightness between the current image and the previous image and then threshold based on that. If something changes the difference between the lightness in the old image and the new image will be bigger than the threshold.

If you want good filtering... the easiest thing to do is a moving average. In python this is easy. Just keep a list of the last N or so values and throw away the last value i the list if it gets larger than N. then to compute the average just do sum() of the list divided by N.

### Re: Trigger on background color change

Posted: Sun Dec 09, 2018 10:15 am
Hi