SimpleCV
From charlesreid1
Installing
Raspberry Pi
Start by installing things SimpleCV will need, namely, Scipy and OpenCV:
$ sudo apt-get install python-scipy $ sudo apt-get install python-opencv
Now install simplecv using pip:
$ sudo pip install simplecv
Using
Here are some sample scripts that show you how to use various functions within SimpleCV.
Capturing images
You can capture images with SimpleCV with the following simple script:
from SimpleCV import Camera import time cam = Camera() time.sleep(3) # wait for the camera to warm up img = cam.getImage() img.save("myimage.png")
You can create a timelapse loop, with a photo every 2 seconds, using a script like this:
from SimpleCV import Camera import os import time from datetime import datetime cam = Camera() time.sleep(0.1) lapse_dir = datetime.strftime(datetime.now(),"timelapse_%Y%m%d-%H%M%S") os.system('mkdir '+lapse_dir) while True: prefix = datetime.strftime(datetime.now(),"%Y%m%d-%H%M%S") filename = lapse_dir+"/"+prefix+".jpg" img = cam.getImage() img.save(filename) print "Saving photo to %s"%(filename) time.sleep(2)
Flags