Monday, January 7, 2013

Taking an image with python on windows

I want to take pictures in python, which will allow eventually to document laser profiles as a function of time or even controll mirrors for active beam stabilization.

For windows:
1) Download and install the PIL, the Python Image Library, - for my windows 7 64 bit system I needed to go to a special precompiled 64 bit version!
http://www.lfd.uci.edu/~gohlke/pythonlibs/    there it was the file PIL-1.1.7.win-amd64-py2.7.‌exe

2) Download the videocapture python extension from http://videocapture.sourceforge.net/ - copy the content of the folders to the corresponding folders in the python directory. I needed to copy the 64 bit DLL into the DLLs folder

3) run this code in IDLE:

from VideoCapture import Device
cam = Device()
cam.saveSnapshot('image.jpg')



No comments:

Post a Comment