I'm trying to monitor a LCD reading using OpenCV (and picamera). I'm taking a reading about every second and I wish that the image is the same for at least three frames (3 seconds). Just to avoid scenarios where I would analyse the image when there is a light switch or something is interrupting the image.
So I read three images in a row and compute the difference between them by printing (img0, img1, img2 are three grayscaled consecutive images):
> print(max(diff(img0,img1), diff(img1,img2), diff(img0, img2)))
where
> def diff(image1, image2):
> return abs(image1-image2).mean()
I've also used absdiff function with similar results.
But it's strange that when there is no image change (visible to me), the values are around 120-160. But when I turn off the lights, the value drops to 110 and then rises to 220. And when I stick a finger to the frame, the value can still be in the 120-160 area. I can't figure out a real pattern that would make a lot of sense. Perhaps the problem is that there is shaking and a lot of per-pixel differences that add up.
Is there a smarter way to do this?
I'm attaching some sample pictures.