We live in a neighborhood that's pretty quiet around Halloween, but we leave a bowl of candy out just in case. And it's always empty by the time we get home.
So, who was taking the candy?
I tried to set up a Pyball to find out. This was done in a hurry, so my hacked together image-difference algorithm was not sophisticated. It just captures two images a second apart, finds the difference of the two images, and computes the mean of the RMS of the differences. In Python, using the PIL library, this is:
deltaImg = ImageChops.difference( baseImg, newImg ) deltaStats = ImageStat.Stat( deltaImg ) rmsValue = numpy.mean( deltaStats.rms )
In reasonable light this seemed to work OK. But when I deployed it to watch the candy bowl I ran into some unexpected problems.
- The default low light performance of the RasPi camera is terrible. I think the only way to get anything useful when the light drops to a lower level is to manually control the shutter speed/ISO of the camera (run raspistill and look under "Image parameter commands").
- Having a decoration full of LED lights really threw the camera for a loop. Because the cheap decoration didn't bother to rectify the power to the LEDs, they blink at 30Hz. Depending on when the shutter snapped, this seemed to wildly throw off the camera exposure, and cause a lot of false positives in my simple motion detection.
I'll be looking into more sophisticated algorithms, both for exposure control and motion detection.
So here's the one photo that sort of worked (though the contrast was massively boosted in Photoshop)