Unifeye SDK Help
Functions

Image sources/cameras

This group contains all functions which belong images sources and cameras. More...

Functions

void activateCamera (int index)
 Activate capturing on a camera.
BSTR getCameraName (int index)
 Retrieve the name of a camera.
float getCameraParameter (BSTR parameter)
 Returns a specific camera parameter of the currently active camera.
BSTR getCameraParametersFile ()
 Returns the path to the camera parameters file which was loaded before via loadCameraParameters().
double getCameraTimestampAdjustment ()
 Returns the timestamp adjustment value of the images.
int getCanVideoSeek ()
 Check if the currently loaded video file is capable of performing a seek operation.
BSTR getCurrentCameraFormat ()
 Get the current format for the running video camera.
double getCurrentVideoPos ()
 Get the current read position (in seconds) within the currently loaded video.
float getMinMaxCameraParameter (BSTR parameter, long isMin)
 Returns a the allowed minimum and maximum for a specific camera parameter of the currently active camera.
int getNumberOfCamsAvailable ()
 Get the number of cameras available on the system.
int getPixelsizeImageSourceX ()
 Get width of source image/video/camera in pixels.
int getPixelsizeImageSourceY ()
 Get height of source image/video/camera in pixels.
BSTR getSupportedCameraFormats ()
 Get the supported formats for the running video camera.
double getVideoDuration ()
 Get the duration of the currently loaded video file stream (in seconds).
long loadCameraParameters (BSTR parameterFile)
 Load a camera parameter file which specifies the camera settings.
void pauseImageSource (long pause)
 Pause / unpause image source.
void saveScreenshot (BSTR path)
 Save a screenshot to the given file.
void saveScreenshotHighRes (BSTR path)
 Save a screenshot to the given file.
void seekVideo (double SeekToInSecs)
 Seek to particular position within the currently loaded video file.
long setCameraFormat (BSTR cameraFormat)
 Sets a camera format for the running video camera.
long setCameraParameter (BSTR parameter, float value)
 Sets a specific camera parameter of the currently active camera.
void setCameraTimestampAdjustment (double timestampAdjustment)
 Adjusts the timestamps of the images of the respective active image source (video, still image, camera).
void setImageSource (BSTR source)
 Set image source to video or still image by giving a path name.
void setVideoLoopMode (long loop)
 Specify if loaded videos should be looped.
void showPinPropertiesOnActivatedCamera ()
 Show pin properties of current of the currently activated (DirectShow) camera.
void showPropertiesOnActivatedCamera ()
 Show general property page of the currently activated (DirectShow) camera.
void startVideo ()
 Start rendering the video stream of the currently loaded video file (if it was stopped before).
void stopVideo ()
 Stop rendering the video stream of the currently loaded video file.

Detailed Description

This group contains all functions which belong images sources and cameras.


Function Documentation

void activateCamera ( int  index)

Activate capturing on a camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and Unifeye SDK Mobile 1.0.

Use this to start capturing on the given camera. Capturing will try to set the resolution from _AR_Settings (videosize_width and videosize_height) with RGB8 and 15 fps. If you put 0,0 in _AR_Settings.xml, the latest values from the camera (regarding resolution, framerate and color format) will be taken. This can be helpfull if you need to configure the camera from another application and then want to take theese changes into effect (e.g. with the SmartView application for AVT cameras). Note, that this does not work for all cameras as they have to remember state. If the camera (or the driver) does not remember state, the default values will be taken.

Parameters:
indexThe index of the camera to activate (zero based).
See also:
The index of a camera is obtained by a call to getNumberOfCamsAvailable().
BSTR getCameraName ( int  index)

Retrieve the name of a camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and Unifeye SDK Mobile 1.0.

Use the index obtained from getNumberOfCamsAvailable() to retrieve friendly names of the devices.

Parameters:
indexIndex of the camera (zero based).
Returns:
Friendly name of the device for the given index.
See also:
getNumberOfCamsAvailable() for obtaining a camera index.
float getCameraParameter ( BSTR   parameter)

Returns a specific camera parameter of the currently active camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and planned in later versions of Unifeye SDK Mobile.

Use this method to retrieve a specific camera parameter. Currently only AVT cameras support this feature (except Cam_FlipMode). The following parameters are available (for an explanation see setCameraParameter()):

  • Cam_FlipImageMode
    • Cam_BayerPattern
    • Cam_Shutter
    • Cam_Gain
    • Cam_Brightness
    • Cam_WhiteBalance_UB
    • Cam_WhiteBalance_VR
    • Cam_Framerate
    • Cam_RoiX
    • Cam_RoiY
    • Cam_RoiWidth
    • Cam_RoiHeight
    • Cam_RoiCentre
Parameters:
parameterThe parameter to retrieve.
Returns:
The according value or -1.0f if the parameter is not supported.
See also:
setCameraParameter()
BSTR getCameraParametersFile ( )

Returns the path to the camera parameters file which was loaded before via loadCameraParameters().

Note that as soon as you change camera parameters (e.g. via setCameraFormat()) this method will return an empty string (as the camera settings have changed and might differ now from the settings loaded before).

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.
Returns:
The path to the camera parameters file which was loaded before.
See also:
loadCameraParameters()
double getCameraTimestampAdjustment ( )

Returns the timestamp adjustment value of the images.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and planned in later versions of Unifeye SDK Mobile.

Note, that for a proper synchronization, the SyncOnImageMode should be used.

Returns:
Adjustment value in milliseconds (positive or negative) which will be added to the timestamp of the images.
See also:
setCameraTimestampAdjustment()
int getCanVideoSeek ( )

Check if the currently loaded video file is capable of performing a seek operation.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

Certain files do not exhibit this feature, e.g. wma streaming files cannot seek.

Returns:
One of the following values:
  • 0: This file does not support any seeking.
  • 1: This file supports full seeking.
  • 2: This file only supports seeking to an absolute position.
  • 3: This file only supports forward seeking.
  • 4: This file only supports backward seeking.
Note:
This is only effective if the image source is a video file stream. It does not have any effect on cameras.
BSTR getCurrentCameraFormat ( )

Get the current format for the running video camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and Unifeye SDK Mobile 1.0.
Returns:
A string containing the formats as "RGB_640x480_15FPS"
See also:
getSupportedCameraFormats
setCameraFormat
double getCurrentVideoPos ( )

Get the current read position (in seconds) within the currently loaded video.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

If the video file is paused or stopped, the current position is the point at which playback will resume.

Returns:
Current read position.
float getMinMaxCameraParameter ( BSTR   parameter,
long  isMin 
)

Returns a the allowed minimum and maximum for a specific camera parameter of the currently active camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and planned in later versions of Unifeye SDK Mobile.

Use this method to retrieve the allowed min and max values for a specific camera parameter. Currently only AVT cameras support this feature (except Cam_FlipMode). The following parameters are available (for an explanation see setCameraParameter()):

  • Cam_FlipImageMode
  • Cam_BayerPattern
  • Cam_Shutter
  • Cam_Gain
  • Cam_Brightness
  • Cam_WhiteBalance_UB
  • Cam_WhiteBalance_VR
  • Cam_Framerate
  • Cam_RoiX
  • Cam_RoiY
  • Cam_RoiWidth
  • Cam_RoiHeight
  • Cam_RoiCentre
Parameters:
parameterThe parameter to retrieve.
isMinIf set the minimum value will be retrieved otherwise the maximum value.
Returns:
The according min. or max. value or -1.0f if the parameter is not supported.
See also:
setCameraParameter(), getCameraParameter()
int getNumberOfCamsAvailable ( )

Get the number of cameras available on the system.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and Unifeye SDK Mobile 1.0.

This function takes a look at the devices plugged into the system and recognizes changes. It should be called everytime a camera is plugged / unplugged into the system.

Returns:
Total number of cameras currently found on the system; 0 is returned in case of no cameras.
int getPixelsizeImageSourceX ( )

Get width of source image/video/camera in pixels.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version, Unifeye SDK Professional Lite and Unifeye SDK Mobile 1.0.
Returns:
Width of the image in pixels.
int getPixelsizeImageSourceY ( )

Get height of source image/video/camera in pixels.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version, Unifeye SDK Professional Lite and Unifeye SDK Mobile 1.0.
Returns:
Height of the image in pixels.
BSTR getSupportedCameraFormats ( )

Get the supported formats for the running video camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and Unifeye SDK Mobile 1.0.

Note, that in case of DirectShow cameras, the list may not contain all possible resolutions and framerates, as, depending on the DirectShow driver/capture filter, resolution and framerate may be altered in discrete steps from a minimum up to a maximum value. For DirectShow cameras it is best to use showPinPropertiesOnActivatedCamera() to show and alter the formats supported by the camera.

Returns:
A string containing all supported formats as "RGB_640x480_15FPS RGB_320x240_15FPS ..."
See also:
getCurrentCameraFormat
setCameraFormat
double getVideoDuration ( )

Get the duration of the currently loaded video file stream (in seconds).

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

Use this to determine the duration of a video file stream.

Note:
This is only applicable to video file streams, not for live video sources such as cameras.
Returns:
Duration of the video file in seconds.
long loadCameraParameters ( BSTR   parameterFile)

Load a camera parameter file which specifies the camera settings.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and Unifeye SDK Mobile 1.0.

Use this method, to load a settings file for currently activated camera. Currently only AVT and IDS cameras support this feature by loading an XML file that was previously saved with AVT SmartView or the according IDS tool. Further note, that calling this function will stop all currently connected cameras. The visualization camera will automatically be restarted afterwards. Currently this feature does NOT work, when you use metaio IR tracking.

NOTE for IDS cameras: At the moment loading the settings file only works if you remove anything from the .ini file that relates to camera resolution (Width, Height property) and the Colormode property. This seems to be a bug in the DirectShow driver of IDS.

Note, that for loading camera calibrations use the methods loadStandardCameraCalibration() or loadExtendedCameraCalibration().

Parameters:
parameterFileThe path to the parameter file.
Returns:
1 successful, 0 otherwise.
See also:
getCameraParametersFile()
void pauseImageSource ( long  pause)

Pause / unpause image source.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and planned in later versions of Unifeye SDK Mobile.

Using this you can pause and later unpause the current image source. This works for video files and cameras.

Parameters:
pause1 to pause, 0 to resume.
void saveScreenshot ( BSTR   path)

Save a screenshot to the given file.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version, Unifeye SDK Professional Lite and Unifeye SDK Mobile 1.0.

You can take a screenshot of the currently displayed image. The screenshot will have the dimensions of the current output window.

Note:
At the moment only bitmaps and jpegs(*.bmp, *.jpg) can be generated.
To produce a correct screenshot, you should not occlude the Unifeye window during the generation of the screenshot.
Parameters:
pathPath to file where the screenshot should be saved to including extension (.bmp or .jpg)
See also:
saveScreenshotHighRes()
void saveScreenshotHighRes ( BSTR   path)

Save a screenshot to the given file.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version, Unifeye SDK Professional Lite and planned in later versions of Unifeye SDK Mobile.

You can take a screenshot of the currently displayed image. The screenshot will have the maximum possible dimensions.

Note:
At the moment only bitmaps and jpegs(*.bmp, *.jpg) can be generated.
To produce a correct screenshot, you should not occlude the _AR_CONTROL during the saving of the screenshot.
Parameters:
pathPath to file where the screenshot should be saved to including extension (.bmp or .jpg)
See also:
saveScreenshot()
void seekVideo ( double  SeekToInSecs)

Seek to particular position within the currently loaded video file.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.
  • If the file is playing at the moment of seek then the file will continue to play after the seek.
  • If the file is stopped then buffers are flushed and a new frame is displayed after the seek.
Parameters:
SeekToInSecsTime to seek to in seconds e.g. 1.4, 0.5, 15.0 etc.
Note:
This is only effective if the image source is a video file stream. It does not have any effect on cameras.
long setCameraFormat ( BSTR  cameraFormat)

Sets a camera format for the running video camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and Unifeye SDK Mobile 1.0.

Such a format string may be retrieved from getSupportedCameraFormats() or derived manually. Note, that this method is currently the only way to set a Format 7 (mode 0) video mode for AVT cameras (besides the configuration via _AR_Settings.xml). A Format 7 video mode will be set internally automatically if you specify a non standard format (e.g. "Y8_800x800_20FPS"). Note, that when using a calibration file, you MUST calibrate for the full resolution (e.g. 1280x1024) as Format 7 will be achieved via region of interest based cropping of the full resolution image. The full resolution can be obtained e.g. via AVT's SmartView application. You need to set the calibration after setting the camera format.

Parameters:
cameraFormatA string representing the desired foramt as "RGB_640x480_15FPS".
Returns:
1 successful, 0 otherwise.
See also:
getSupportedCameraFormats()
getCurrentCameraFormat()
long setCameraParameter ( BSTR   parameter,
float  value 
)

Sets a specific camera parameter of the currently active camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and planned in later versions of Unifeye SDK Mobile.

Use this method to set a specific camera parameter. Currently only AVT cameras support this feature (except the parameter Cam_FlipMode). The following parameters are available:

  • Cam_FlipImageMode sets the flip mode of the image (0 = no flip, 1 = flip at y-axis (vertical), 2 = flip at x-axis (horizontal), 3 = both). Important: If you are using the image flip mode and a camera calibration make sure to create the camera calibration with the already flipped image! Otherwise the calibration parameters do not correspond to the actual image any more. You can also flip the image in general by adjusting the _AR_Settings.xml file using the <ImageFlipMode> tag.
  • Cam_BayerPattern sets the bayer pattern to be used.
  • Cam_Shutter sets the shutter.
  • Cam_Gain sets the gain value.
  • Cam_Brightness sets the brightness value.
  • Cam_WhiteBalance_UB sets the UB value for white balancing.
  • Cam_WhiteBalance_VR sets the VR value for white balancing.
  • Cam_Framerate sets the framerate.
  • Cam_RoiX sets the x origin for a ROI.
  • Cam_RoiY sets the y origin for a ROI.
  • Cam_RoiWidth sets the width for a ROI.
  • Cam_RoiHeight sets the height for a ROI.
  • Cam_RoiCentre centers the ROI in the original frame.

Note that you can also use loadCameraParameters() to load camera specific settings for AVT cameras, which is the recommended way as the camera parameters won't be stored in a scene file in contrast to the camera parameters file. Only the values that are not stored in a camera parameter file:

  • Cam_FlipImageMode,
  • Cam_BayerPattern are stored in a Unifeye scene file, as these are not camera internal parameters.

Further note on ROIs: Note that currently settings ROIs is only possible if you have selected a Format 7 mode 0 video format (see setCameraFormat()).

Parameters:
parameterThe parameter to change.
valueThe value of the parameter.
Returns:
1 successful, 0 otherwise.
See also:
loadCameraParameters(), getCameraParameter()
void setCameraTimestampAdjustment ( double  timestampAdjustment)

Adjusts the timestamps of the images of the respective active image source (video, still image, camera).

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version and planned in later versions of Unifeye SDK Mobile.

The timestamp of the images of the currently active camera is adjusted by the given value. Thus, you can e.g. shift the timestamp back and forth in time which might be needed to allow proper synchronization of camera images and tracking data. This is e.g. the case when synchronizing with IR tracking or FARO tracking. Generally, every arriving image from a camera gets the timestamp of it's arrival in the system. But this timestamp usually does not correspond to the timestamp when image was actually taken in the camera. So by giving a (negative) timestamp adjustment you can correct this behaviour.

Note, that for a proper synchronization, the SyncOnImageMode should be used. Further note, that this value will be set generally and will persisit even when you switch to another camera.

Parameters:
timestampAdjustmentAdjustment in milliseconds (positive or negative) which will be added to the timestamp of the images.
void setImageSource ( BSTR   source)

Set image source to video or still image by giving a path name.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate, Unifeye SDK Professional Demo version, Unifeye SDK Professional Lite and Unifeye SDK Mobile 1.0.

This method is used to set the image source for display and (optical) tracking. The image source can be any string representing a fully qualified path to a video file or a still image e.g. "c:\image\1.jpg" or "c:\video\video1.avi". Also URL paths are allowed like http://192.168.100.1/myImage.jpg.

Parameters:
sourceA fully qualified path to a video or image file.
void setVideoLoopMode ( long  loop)

Specify if loaded videos should be looped.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

The video stream can be made to play back in a continous loop or just once. Using this function, you can choose between these two modes.

Parameters:
loop1 to enable looping, 0 for single shot mode.
void showPinPropertiesOnActivatedCamera ( )

Show pin properties of current of the currently activated (DirectShow) camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

The pin properties are mainly image formats (e.g. RGB, YUV etc.) and image size (320x240, 640x480 etc). After setting these parameters, one must close this property page. The camera will automatically re-connect and apply any changes that were made.

Note:
The camera MUST be activated before calling this function.
This does only work with DirectShow cameras.
PinProperties.bmp
void showPropertiesOnActivatedCamera ( )

Show general property page of the currently activated (DirectShow) camera.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

The general properties are the ones provided by the camera driver, e.g. brightness/contrast/sharpness/white balance/refresh rate. Using this function, you can open a properties page and adjust these values accordingly.

Note:
The camera MUST be activated before calling this function.
This does only work with DirectShow cameras.
Properties.bmp
void startVideo ( )

Start rendering the video stream of the currently loaded video file (if it was stopped before).

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

Use this to start rendering the video stream.

See also:
stopVideo() to stop rendering.
void stopVideo ( )

Stop rendering the video stream of the currently loaded video file.

Note:
Available in Unifeye SDK Professional, Unifeye SDK Ultimate and Unifeye SDK Professional Demo version.

The file read pointer is moved to start of the video. I.e. the video will resume playback from the beginning when resumed.

See also:
startVideo()
pauseImageSource() for pausing an video file stream.
 All Data Structures Namespaces Functions

Unifeye SDK v. 4.0 2011