Up | Draw | Overlay | Tool | Toollist | Timer | SPB | Camera | CameraImage | Bitmap | Historylist - ImageBuffer | Clipboard | ScorpionGeometry | Statistics | States | Logging | Panels | Shared Memory | BarCode Reader | StdCtrls

CameraCalibration | Release Notes

  

Camera
The Camera class

Use the function GetCamera(name) to retrieve an instance of the class.
The name may be replaced by the camera index as string, cam=GetCamera('0') 

Attribute Access Type Description
name R/W string the name of the camera
index R int index of camera [0..>
grabber R int assigned grabberno [0..>
port R int assigned portno [0..>
driver R string the cameradriver for this camera
width R int width of image
height R int height of image
open R/W 0/1 0=closed, 1=open
hwtrigger R/W 0/1 0=off, 1=on
calibrated R 0/1 0=uncalibrated 1=calibrated
pitch R (x,y,unit) returns pitch tuple (float,float,string)
errorColor R/W byte pixelvalue of error images
errorFile R/W string filename of error images
timeoutDelay R/W int timeout period in ms
timeoutColor R/W byte pixelvalue of timeout images
timeoutFile R/W string filename of timeout images
fifoColor R/W byte pixelvalue of fifo images. Note! flush() must be called after changed
fifoFile R/W string filename of fifo images.  Note! flush() must be called after changed

 

Method Returns Description
getPropertyRange(name) int, int returns min and max of the property. If the property is not supported the method returns None.
getProperty(name) ImageList returns current value of the property. If the property is not supported the method returns None.
setProperty(name,value) 0/1 returns 0 on fail, else 1 
flush() 0/1 flushes image Fifo
executeCmd(cmd,params) 0/1 send a command request to camera. The "cmd" and "params" is driver/camera specific, see documentation for actual cameradriver for supported commands.
edit([tabindex]) 0/1 open the camera configuration dialog. Optional tabindex (string) may be given to show one page only. Using tabindex='0' launces the advanced dialog if supported by camera.

The CameraList class

Use the function GetCameras() to get the list of all defined cameras in Scorpion.

Attribute Access Type Description
count R int number of defined cameras in system
openCount R int number of open cameras in system

 

Method Returns Description
setOpen(value) 0/1 value=0 to close, value=1 to open. If open the method returns 1 if all cameras opened successfully, else 0.
getCamera(index) Camera returns a camera object if index is in range. The index is zero-based.
reset() 0/1 returns 1 for ok, 0 for error. Note that the reset command can not be called from within the camera error handler.
flush() 0/1 flushes image fifo buffers for all cameras
browse() string returns a commaseparated list of cameranames of all currently available cameras

Example 1: Define a Camera Error Handle in Central

def Handle_System_CameraError(CameraNo,Camera):
#
# CameraNo = VT_I4
# Comment = VT_BSTR
#
  cam=GetCamera(Camera)
  if cam<>None:
    print 'Camera name:',cam.name

  cam=GetCamera('0')
  if cam<>None:
    if cam.open: 
      print cam.name, ' is open'
    else:
      print cam.name, ' is closed'

Example 2: Iterate all cameras to get open state

cameras=GetCameras()
if cameras<>None:
  n=cameras.count
  if cameras.openCount<>n:
    for i in range(n):
    cam=cameras.getCamera(i)
    if cam<>None:
      print i,cam.name,cam.open

Example 3: Iterate all cameras to set camera Properties - Shutter and Gain

def AdjustCamera():

  def setProp(prop,val):
    cams=GetCameras()
    for i in range(cams.count):
      cam=cams.getCamera(i)
      if cam.setProperty(prop,val)==0: print 'set',prop,'failed'
      print cam.name, prop, cam.getPropertyRange(prop),cam.getProperty(prop)

  setProp('shutter',450)
  setProp('gain',190)

Example 4: Toggling continous for all cameras in profile

def ToggleContinous():
  cams=GetCameras()
  continous=cams.getCamera(0).getProperty('continous')
  for i in range(cams.count):
    cam=cams.getCamera(i)
    cam.setProperty('continous',not continous)
    print cam.name,getCamera(0).getProperty('continous')
 

 

Scorpion Vision Software Version: 9.2.0.515 - Date: 20120502
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2012 Tordivel AS.