pydicamsdk
A wrapper for the pco sensicam/dicam SDK
This class is a Python wrapper for the Sensicam SDK of pco AG, Germany and provides an API to handle an pco camera in python. It is tested and used with a Dicam Pro.
class sensicam
The constructor automatically intialized the PCI board and allocates hdriver accordingly. The class sensicam is used for the control of the camera
class imgBuf
The class imgBuf is the object-oriented approach for the image buffers and aims to have buffer management within python.
Example
import dicamsdk
board = 0
with dicamsdk.sensicam(board) as pcoCam:
# Setup a the COC
gain = 0 # normal analog gain
submode = 0 # sequential, busy out
roixmin = 1
roixmax = 1
roiymin = 1
roiymax = 1
hbin = 1
vbin = 1
# Table values:
phosphordecay, mcpgain, trigger, loops = 100, 999, 0, 1
imageTime1 = [0, 1000, 0, 300]
table = pcoCam.dicamTableGen(phosphordecay, mcpgain, trigger, loops,
imageTime1)
camera_type = 5 # For dicam pro
pcoCam.setCoc(gain, camera_type, submode, roixmin, roixmax, roiymin,
roiymax, hbin, vbin, table)
print("COC loaded")
# Get sizes and allocate buffer
pcoCam.getSizes()
# Initialize a buffer
curBuf = dicamsdk.imgBuf()
pcoCam.allocateBuffer(curBuf)
pcoCam.mapBuffer(curBuf)
pcoCam.setBufferEvent(curBuf)
# Set camera to state RUN
pcoCam.runCoc()
# Acquire and show the image
pcoCam.readImage12bit(curBuf)
im, npImage = pcoCam.getImageFromBuffer(curBuf)
im.show()
# Convert the rawImage to 8 bit
exportImage = im.convert("L")
exportImage.save("test.png")
# Stop the camera, only necessary in continuous trigger mode.
# pcoCam.stopCoc()
# Free all buffers and close the camera
pcoCam.freeBuffer(curBuf)
print("Card closed.")