Thursday, November 7, 2013

More about the Pi Camera and Python 

Some years ago the NY Times asked actual children to write reviews of childrens' books. The selections were assigned randomly. A 12-year-old girl got a book on snakes. Her review is reproduced here in its entirety: "That book taught me more about snakes than I ever wanted to know."

If you want to mess with image files in Python you might get to feel like the 12-year old. After getting the camera installed you then have to get PIL (as a guess, Python Image Library):

sudo apt-get install python-imaging

Then there's the documentation:

77 pages!

Concerning my experience with the camera:

My Python program executes the "raspistill" app to get an image. I've learned how to examine the image file. If you do this, you want to capture an uncompressed image: use the "-o bmp" format.

Anyway, I can detect motion, adjust for low light (to some extent), snap a higher-res image and email a warning to myself. However, I can't do anything practical with this because of the 6" cable on the camera module -- unless I buy a second Pi dedicated to the camera.

Above, my latest device: an 8-switch opto-isolated relay board. I haven't got anything connected yet but I had it clicking on and off within a few minutes.

No comments:

Post a Comment