Sunday, November 3, 2013

Post 34: The Raspberry Pi Camera

I bought my camera from Newark/Element 14 which is the only place I found the minimum $25 price. Then I followed the installation instructions from--

(others available). I also looked at--

Which includes Python code for comparing images -- as for a security camera. As it happens, their code resembles what I would have done if I'd had to start from scratch -- by comparing the same pixel position in successive low-res images. Since the G (green) part of RGB contains 70% of an image's grayscale information, R and B values can be ignored for a motion detection application. Thanks to the Raspi org I got my camera working with very little learning curve pain.

The way one captures an image is with the command line program "raspistill". This app has no Unix-style man page but if you know to execute--

$ raspistill -?

You'll get by.

In my little test program I wanted to learn just how how much difference to expect when there should have been no change at all. Here are the counts for 5 pair-wise comparisons of 120x90-pixel images:

0  d: 29008
1  d: 19889
2  d: 4704
3  d: 256
4  d: 71
5  d: 25
6  d: 15
7  d: 13
8  d: 8
9  d: 3
10  d: 1
11  d: 5
12  d: 1
16  d: 1

sum: 54000

What this means is that out of the total pixel count of 6 images (54,000) nearly 30k were exactly the same, 20k were off by one, etc.

BTW: the 15cm ribbon cable is a real pain. The only place listing longer cables seems to be--

Only from the Netherlands? Give me a break!

No comments:

Post a Comment