ExamplesΒΆ

Example 1: Start Continuous grabbing:

cam = GetCamera('0')
cam.SetProperty('continuous', 1)

Example 2: Stop Continuous grabbing:

cam = GetCamera('0')
cam.setProperty('continuous', 0)

Example 4: Set Exposure Time:

cam = GetCamera('0')
cam.setProperty('ExposureTime', 500)

Example 5: Enable triggering:

cam = GetCamera('0')
cam.setProperty('TriggerMode', 1)

Example 6: Software Trigger:

Go to camera properties dialog and configure the following:

  Set 'Trigger' to 'ON'
  Set 'TriggerInhibit' to 'OFF'
  Select 'TriggerSource' value 'Software'

In Scorpion profile:

cam = GetCamera('0')
cam.setProperty('SoftwareTrigger', 1)

Example 7: SetCameraBlackLevel():

def SetCameraBlackLevel(CamString='0',l1,l2,l3):
  cam = GetCamera(CamString)
  cam.setProperty('0xA0002038', l1) #pedastal level 0-2047
  cam.setProperty('0xA0002000', l2) #Clamp Level L 0-1027
  cam.setProperty('0xA0002004', l3) #Clamp Level R 0-1027

Example 8: SetCameraLUTformat():

def SetCameraLUTformat(CamString='0',lutFormat = 0):
  lutFormatText = {}
  lutFormatText[0] = 'linear'
  lutFormatText[1] = 'reverse'
  lutFormatText[2] = 'binarization'
  lutFormatText[3] = 'gamma curve'
  lutFormatText[4] = 'user table'
  cam = GetCamera(CamString)
  oldLutFormat = cam.getProperty('0xA000205C')
  print 'lutFormat', oldLutFormat, lutFormatText[oldLutFormat], 'changed to', lutFormat, lutFormatText[lutFormat]
  cam.setProperty('0xA000205C', lutFormat)

Example 9: SetCameraLUTtable():

def SetCameraLUTtable(CamString='0'):
  def CreateLogTable():
    import math, array
    UINT16_MAX = ((1 << 16) - 1)
    VALUE_MAX = ((1 << 12) - 1)
    almostMax = float(VALUE_MAX + 1) - 0.001
    floatMax = float(VALUE_MAX + 1)
    logTable = []
    f = almostMax / (math.log((UINT16_MAX / floatMax) + 1))
    ix = 0
    for ix in range(0, UINT16_MAX + 1):
      value = f * math.log((ix / floatMax) + 1)
      logTable.append(value)
    return logTable

  cam = GetCamera(CamString)
  lutTable = CreateLogTable()
  print 'SetCameraLUTtable:'
  print ' lutTable created, length', len(lutTable)
  print ' sending table to camera - may take 2 minutes or so'
  for ix in range(0, 4096):
    regAddr = 0xA0010000 + ix * 4
    value = lutTable[ix * 16 + 8]
    cam.setProperty('0x%X' % regAddr, int(value))

Example 10: SetCameraTrigMode(mode):

def SetCameraTrigMode(mode,continous=-1):
  acquisitionMode = 1
  triggerSource = 0
  triggerMode = 0
  if mode.lower() == 'hardware':
    acquisitionMode = 1 # mode = single frame
    triggerSource = 0 # source = hardware
    triggerMode = 1 # trigger to ON
    if continous == -1:
      bContinous = 1
    elif :
      bContinous = continous
  elif mode.lower() == 'software':
    acquisitionMode = 1 # mode = free run
    triggerSource = 1 # source = software
    triggerMode = 1 # trigger to ON
    if continous == -1:
      bContinous = 0
    elif :
      bContinous = continous
  elif mode.lower() == 'freerun':
    acquisitionMode = 1 # mode = free run
    triggerSource = 1 # source = software
    triggerMode = 0 # trigger to OFF
    if continous == -1:
      bContinous = 0
    elif :
      bContinous = continous

  else:
    print 'SetCameraTrigMode - invalid parameter', mode
    print 'Accepted parameters: hardware | software | freerun'
    return

  print 'SetCameraTrigMode', mode
  cameras = GetCameras()
  if cameras <> None:
    n = cameras.count
    for i in range(n):
      cam = cameras.getCamera(i)
      if cam <> None:
        cam.setProperty('0xA0000200', acquisitionMode)
        cam.setProperty('0xA0002098', triggerSource)
        cam.setProperty('0xA0002044', triggerMode)
        cam.setProperty('continuous', bContinous )