Operator Reference

open_framegrabberT_open_framegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber (Operator)

open_framegrabberT_open_framegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber — Open and configure an image acquisition device.

Signature

Herror T_open_framegrabber(const Htuple Name, const Htuple HorizontalResolution, const Htuple VerticalResolution, const Htuple ImageWidth, const Htuple ImageHeight, const Htuple StartRow, const Htuple StartColumn, const Htuple Field, const Htuple BitsPerChannel, const Htuple ColorSpace, const Htuple Generic, const Htuple ExternalTrigger, const Htuple CameraType, const Htuple Device, const Htuple Port, const Htuple LineIn, Htuple* AcqHandle)

void OpenFramegrabber(const HTuple& Name, const HTuple& HorizontalResolution, const HTuple& VerticalResolution, const HTuple& ImageWidth, const HTuple& ImageHeight, const HTuple& StartRow, const HTuple& StartColumn, const HTuple& Field, const HTuple& BitsPerChannel, const HTuple& ColorSpace, const HTuple& Generic, const HTuple& ExternalTrigger, const HTuple& CameraType, const HTuple& Device, const HTuple& Port, const HTuple& LineIn, HTuple* AcqHandle)

void HFramegrabber::HFramegrabber(const HString& Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const HString& Field, const HTuple& BitsPerChannel, const HTuple& ColorSpace, const HTuple& Generic, const HString& ExternalTrigger, const HTuple& CameraType, const HTuple& Device, const HTuple& Port, const HTuple& LineIn)

void HFramegrabber::HFramegrabber(const HString& Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const HString& Field, Hlong BitsPerChannel, const HString& ColorSpace, double Generic, const HString& ExternalTrigger, const HString& CameraType, const HString& Device, Hlong Port, Hlong LineIn)

void HFramegrabber::HFramegrabber(const char* Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const char* Field, Hlong BitsPerChannel, const char* ColorSpace, double Generic, const char* ExternalTrigger, const char* CameraType, const char* Device, Hlong Port, Hlong LineIn)

void HFramegrabber::HFramegrabber(const wchar_t* Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const wchar_t* Field, Hlong BitsPerChannel, const wchar_t* ColorSpace, double Generic, const wchar_t* ExternalTrigger, const wchar_t* CameraType, const wchar_t* Device, Hlong Port, Hlong LineIn)   ( Windows only)

void HFramegrabber::OpenFramegrabber(const HString& Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const HString& Field, const HTuple& BitsPerChannel, const HTuple& ColorSpace, const HTuple& Generic, const HString& ExternalTrigger, const HTuple& CameraType, const HTuple& Device, const HTuple& Port, const HTuple& LineIn)

void HFramegrabber::OpenFramegrabber(const HString& Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const HString& Field, Hlong BitsPerChannel, const HString& ColorSpace, double Generic, const HString& ExternalTrigger, const HString& CameraType, const HString& Device, Hlong Port, Hlong LineIn)

void HFramegrabber::OpenFramegrabber(const char* Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const char* Field, Hlong BitsPerChannel, const char* ColorSpace, double Generic, const char* ExternalTrigger, const char* CameraType, const char* Device, Hlong Port, Hlong LineIn)

void HFramegrabber::OpenFramegrabber(const wchar_t* Name, Hlong HorizontalResolution, Hlong VerticalResolution, Hlong ImageWidth, Hlong ImageHeight, Hlong StartRow, Hlong StartColumn, const wchar_t* Field, Hlong BitsPerChannel, const wchar_t* ColorSpace, double Generic, const wchar_t* ExternalTrigger, const wchar_t* CameraType, const wchar_t* Device, Hlong Port, Hlong LineIn)   ( Windows only)

static void HOperatorSet.OpenFramegrabber(HTuple name, HTuple horizontalResolution, HTuple verticalResolution, HTuple imageWidth, HTuple imageHeight, HTuple startRow, HTuple startColumn, HTuple field, HTuple bitsPerChannel, HTuple colorSpace, HTuple generic, HTuple externalTrigger, HTuple cameraType, HTuple device, HTuple port, HTuple lineIn, out HTuple acqHandle)

public HFramegrabber(string name, int horizontalResolution, int verticalResolution, int imageWidth, int imageHeight, int startRow, int startColumn, string field, HTuple bitsPerChannel, HTuple colorSpace, HTuple generic, string externalTrigger, HTuple cameraType, HTuple device, HTuple port, HTuple lineIn)

public HFramegrabber(string name, int horizontalResolution, int verticalResolution, int imageWidth, int imageHeight, int startRow, int startColumn, string field, int bitsPerChannel, string colorSpace, double generic, string externalTrigger, string cameraType, string device, int port, int lineIn)

void HFramegrabber.OpenFramegrabber(string name, int horizontalResolution, int verticalResolution, int imageWidth, int imageHeight, int startRow, int startColumn, string field, HTuple bitsPerChannel, HTuple colorSpace, HTuple generic, string externalTrigger, HTuple cameraType, HTuple device, HTuple port, HTuple lineIn)

void HFramegrabber.OpenFramegrabber(string name, int horizontalResolution, int verticalResolution, int imageWidth, int imageHeight, int startRow, int startColumn, string field, int bitsPerChannel, string colorSpace, double generic, string externalTrigger, string cameraType, string device, int port, int lineIn)

def open_framegrabber(name: str, horizontal_resolution: int, vertical_resolution: int, image_width: int, image_height: int, start_row: int, start_column: int, field: str, bits_per_channel: MaybeSequence[int], color_space: MaybeSequence[str], generic: MaybeSequence[Union[str, float, int]], external_trigger: str, camera_type: MaybeSequence[str], device: MaybeSequence[str], port: MaybeSequence[int], line_in: MaybeSequence[int]) -> HHandle

Description

The operator open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber opens and configures the chosen image acquisition device. During this process, the connection to the image acquisition device is tested, the image acquisition device is locked for other processes, and, if necessary, memory is reserved for the data buffers. The actual image grabbing is done via the operators grab_imagegrab_imageGrabImageGrabImagegrab_image, grab_datagrab_dataGrabDataGrabDatagrab_data, grab_image_asyncgrab_image_asyncGrabImageAsyncGrabImageAsyncgrab_image_async, or grab_data_asyncgrab_data_asyncGrabDataAsyncGrabDataAsyncgrab_data_async. If the image acquisition device is not needed anymore, it should be closed via the operator close_framegrabberclose_framegrabberCloseFramegrabberCloseFramegrabberclose_framegrabber, releasing it for other processes. Some image acquisition devices allow to open several instances of the same image acquisition device class.

For all parameters image acquisition device-specific default values can be chosen explicitly (see the parameter description below). Additional information for a specific image acquisition device is available via info_framegrabberinfo_framegrabberInfoFramegrabberInfoFramegrabberinfo_framegrabber. A comprehensive documentation of all image acquisition device-specific parameters can be found in the corresponding interface documentation in the directory doc/html/reference/acquisition.

The meaning of the particular parameters is as follows:

HorizontalResolutionHorizontalResolutionHorizontalResolutionhorizontalResolutionhorizontal_resolution, VerticalResolutionVerticalResolutionVerticalResolutionverticalResolutionvertical_resolution

Desired resolution of the image acquisition device.

ImageWidthImageWidthImageWidthimageWidthimage_width, ImageHeightImageHeightImageHeightimageHeightimage_height

Size of the image part to be returned by grab_imagegrab_imageGrabImageGrabImagegrab_image etc.

StartRowStartRowStartRowstartRowstart_row, StartColumnStartColumnStartColumnstartColumnstart_column

Upper left corner of the desired image area.

FieldFieldFieldfieldfield

Desired half image ('first'"first""first""first""first", 'second'"second""second""second""second", or 'next'"next""next""next""next") or selection of a full image.

BitsPerChannelBitsPerChannelBitsPerChannelbitsPerChannelbits_per_channel

Number of bits, which are transferred from the image acquisition device per pixel and image channel (typically 5, 8, 10, 12, or 16).

ColorSpaceColorSpaceColorSpacecolorSpacecolor_space

Output color format of the grabbed images (typically 'gray'"gray""gray""gray""gray" or 'raw'"raw""raw""raw""raw" for single-channel or 'rgb'"rgb""rgb""rgb""rgb" or 'yuv'"yuv""yuv""yuv""yuv" for three-channel images).

GenericGenericGenericgenericgeneric

Generic parameter with device-specific meaning which can be queried by info_framegrabberinfo_framegrabberInfoFramegrabberInfoFramegrabberinfo_framegrabber.

ExternalTriggerExternalTriggerExternalTriggerexternalTriggerexternal_trigger

Activation of external triggering (if available).

CameraTypeCameraTypeCameraTypecameraTypecamera_type

More detailed specification of the desired image acquisition device (typically the type of the analog video format or the name of the desired camera configuration file).

DeviceDeviceDevicedevicedevice

Device name of the image acquisition device.

PortPortPortportport

Port the image acquisition device is connected to.

LineInLineInLineInlineInline_in

Camera input line of multiplexer (if available).

The operator open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber returns a handle (AcqHandleAcqHandleAcqHandleacqHandleacq_handle) to the opened image acquisition device.

Attention

Due to the multitude of supported image acquisition devices, open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber contains a large number of parameters. However, not all parameters are needed for a specific image acquisition device.

For a multithreaded application, info_framegrabberinfo_framegrabberInfoFramegrabberInfoFramegrabberinfo_framegrabber, open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber, and close_framegrabberclose_framegrabberCloseFramegrabberCloseFramegrabberclose_framegrabber are executed exclusively. Thus, they block the concurrent execution of each other, but run in parallel with all non-exclusive operators outside of this group.

On Windows Systems, error dialog boxes from the operating system can occur when dependency modules of the interface are not found, e.g., the according SDK was not installed. The occurrence of the error boxes can be controlled by setting Windows' Error Mode. Please refer to the description of SetErrorMode within the Windows MSDN documentation.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

NameNameNamenamename (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

HALCON image acquisition interface name, i.e., name of the corresponding DLL (Windows) or shared library (Linux).

Default: 'File' "File" "File" "File" "File"

Suggested values: 'ABS'"ABS""ABS""ABS""ABS", 'ADLINK'"ADLINK""ADLINK""ADLINK""ADLINK", 'AlkUSB3'"AlkUSB3""AlkUSB3""AlkUSB3""AlkUSB3", 'Andor'"Andor""Andor""Andor""Andor", 'BitFlow'"BitFlow""BitFlow""BitFlow""BitFlow", 'Crevis'"Crevis""Crevis""Crevis""Crevis", 'DahengCAM'"DahengCAM""DahengCAM""DahengCAM""DahengCAM", 'DirectFile'"DirectFile""DirectFile""DirectFile""DirectFile", 'DirectShow'"DirectShow""DirectShow""DirectShow""DirectShow", 'Ensenso-NxLib'"Ensenso-NxLib""Ensenso-NxLib""Ensenso-NxLib""Ensenso-NxLib", 'File'"File""File""File""File", 'FocalSpecLCI'"FocalSpecLCI""FocalSpecLCI""FocalSpecLCI""FocalSpecLCI", 'GenICamTL'"GenICamTL""GenICamTL""GenICamTL""GenICamTL", 'GigEVision2'"GigEVision2""GigEVision2""GigEVision2""GigEVision2", 'GingaDG'"GingaDG""GingaDG""GingaDG""GingaDG", 'Ginga++'"Ginga++""Ginga++""Ginga++""Ginga++", 'GStreamer'"GStreamer""GStreamer""GStreamer""GStreamer", 'heliCamC3'"heliCamC3""heliCamC3""heliCamC3""heliCamC3", 'KeyenceVJ'"KeyenceVJ""KeyenceVJ""KeyenceVJ""KeyenceVJ", 'LinX'"LinX""LinX""LinX""LinX", 'LPS36'"LPS36""LPS36""LPS36""LPS36", 'LuCam'"LuCam""LuCam""LuCam""LuCam", 'MatrixVisionAcquire'"MatrixVisionAcquire""MatrixVisionAcquire""MatrixVisionAcquire""MatrixVisionAcquire", 'MediaFoundation'"MediaFoundation""MediaFoundation""MediaFoundation""MediaFoundation", 'MILLite'"MILLite""MILLite""MILLite""MILLite", 'MultiCam'"MultiCam""MultiCam""MultiCam""MultiCam", 'O3D3xx'"O3D3xx""O3D3xx""O3D3xx""O3D3xx", 'Opteon'"Opteon""Opteon""Opteon""Opteon", 'PhoXi'"PhoXi""PhoXi""PhoXi""PhoXi", 'PixeLINK'"PixeLINK""PixeLINK""PixeLINK""PixeLINK", 'pylon'"pylon""pylon""pylon""pylon", 'RealSense'"RealSense""RealSense""RealSense""RealSense", 'SaperaLT'"SaperaLT""SaperaLT""SaperaLT""SaperaLT", 'Sentech'"Sentech""Sentech""Sentech""Sentech", 'SICK-3DCamera'"SICK-3DCamera""SICK-3DCamera""SICK-3DCamera""SICK-3DCamera", 'SICK-ScanningRuler'"SICK-ScanningRuler""SICK-ScanningRuler""SICK-ScanningRuler""SICK-ScanningRuler", 'SiliconSoftware'"SiliconSoftware""SiliconSoftware""SiliconSoftware""SiliconSoftware", 'Slink'"Slink""Slink""Slink""Slink", 'TWAIN'"TWAIN""TWAIN""TWAIN""TWAIN", 'uEye'"uEye""uEye""uEye""uEye", 'USB3Vision'"USB3Vision""USB3Vision""USB3Vision""USB3Vision", 'Video4Linux2'"Video4Linux2""Video4Linux2""Video4Linux2""Video4Linux2", 'VRmUsbCam'"VRmUsbCam""VRmUsbCam""VRmUsbCam""VRmUsbCam"

HorizontalResolutionHorizontalResolutionHorizontalResolutionhorizontalResolutionhorizontal_resolution (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Desired horizontal resolution of image acquisition interface (absolute value or 1 for full resolution, 2 for half resolution, or 4 for quarter resolution).

Default: 1

Suggested values: 1, 2, 4, 1600, 1280, 768, 640, 384, 320, 192, 160, -1

VerticalResolutionVerticalResolutionVerticalResolutionverticalResolutionvertical_resolution (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Desired vertical resolution of image acquisition interface (absolute value or 1 for full resolution, 2 for half resolution, or 4 for quarter resolution).

Default: 1

Suggested values: 1, 2, 4, 1200, 1024, 576, 480, 288, 240, 144, 120, -1

ImageWidthImageWidthImageWidthimageWidthimage_width (input_control)  rectangle.extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of desired image part (absolute value or 0 for HorizontalResolutionHorizontalResolutionHorizontalResolutionhorizontalResolutionhorizontal_resolution - 2*StartColumnStartColumnStartColumnstartColumnstart_column).

Default: 0

Suggested values: 0, -1

ImageHeightImageHeightImageHeightimageHeightimage_height (input_control)  rectangle.extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of desired image part (absolute value or 0 for VerticalResolutionVerticalResolutionVerticalResolutionverticalResolutionvertical_resolution - 2*StartRowStartRowStartRowstartRowstart_row).

Default: 0

Suggested values: 0, -1

StartRowStartRowStartRowstartRowstart_row (input_control)  rectangle.origin.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Line number of upper left corner of desired image part (or border height if ImageHeightImageHeightImageHeightimageHeightimage_height = 0).

Default: 0

Suggested values: 0, -1

StartColumnStartColumnStartColumnstartColumnstart_column (input_control)  rectangle.origin.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column number of upper left corner of desired image part (or border width if ImageWidthImageWidthImageWidthimageWidthimage_width = 0).

Default: 0

Suggested values: 0, -1

FieldFieldFieldfieldfield (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Desired half image or full image.

Default: 'default' "default" "default" "default" "default"

Suggested values: 'first'"first""first""first""first", 'second'"second""second""second""second", 'next'"next""next""next""next", 'interlaced'"interlaced""interlaced""interlaced""interlaced", 'progressive'"progressive""progressive""progressive""progressive", 'default'"default""default""default""default"

BitsPerChannelBitsPerChannelBitsPerChannelbitsPerChannelbits_per_channel (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of transferred bits per pixel and image channel (-1: device-specific default value).

Default: -1

Suggested values: 5, 8, 10, 12, 14, 16, -1

ColorSpaceColorSpaceColorSpacecolorSpacecolor_space (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Output color format of the grabbed images, typically 'gray'"gray""gray""gray""gray" or 'raw'"raw""raw""raw""raw" for single-channel or 'rgb'"rgb""rgb""rgb""rgb" or 'yuv'"yuv""yuv""yuv""yuv" for three-channel images ('default'"default""default""default""default": device-specific default value).

Default: 'default' "default" "default" "default" "default"

Suggested values: 'gray'"gray""gray""gray""gray", 'raw'"raw""raw""raw""raw", 'rgb'"rgb""rgb""rgb""rgb", 'yuv'"yuv""yuv""yuv""yuv", 'default'"default""default""default""default"

GenericGenericGenericgenericgeneric (input_control)  string(-array) HTupleMaybeSequence[Union[str, float, int]]HTupleHtuple (real / string / integer) (double / string / int / long) (double / HString / Hlong) (double / char* / Hlong)

Generic parameter with device-specific meaning.

Default: -1

ExternalTriggerExternalTriggerExternalTriggerexternalTriggerexternal_trigger (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

External triggering.

Default: 'default' "default" "default" "default" "default"

List of values: 'default'"default""default""default""default", 'false'"false""false""false""false", 'true'"true""true""true""true"

CameraTypeCameraTypeCameraTypecameraTypecamera_type (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Type of used camera ('default'"default""default""default""default": device-specific default value).

Default: 'default' "default" "default" "default" "default"

Suggested values: 'ntsc'"ntsc""ntsc""ntsc""ntsc", 'pal'"pal""pal""pal""pal", 'auto'"auto""auto""auto""auto", 'default'"default""default""default""default"

DeviceDeviceDevicedevicedevice (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Device the image acquisition device is connected to ('default'"default""default""default""default": device-specific default value).

Default: 'default' "default" "default" "default" "default"

Suggested values: '-1'"-1""-1""-1""-1", '0'"0""0""0""0", '1'"1""1""1""1", '2'"2""2""2""2", '3'"3""3""3""3", 'default'"default""default""default""default"

PortPortPortportport (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Port the image acquisition device is connected to (-1: device-specific default value).

Default: -1

Suggested values: 0, 1, 2, 3, -1

LineInLineInLineInlineInline_in (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Camera input line of multiplexer (-1: device-specific default value).

Default: -1

Suggested values: 1, 2, 3, 4, -1

AcqHandleAcqHandleAcqHandleacqHandleacq_handle (output_control)  framegrabber HFramegrabber, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the opened image acquisition device.

Example (HDevelop)

* Select a suitable image acquisition interface name AcqName
info_framegrabber(AcqName,'port',Information,Values)
* Open image acquisition device using the default settings, see
* documentation of the actually used interface for more details
open_framegrabber(AcqName,1,1,0,0,0,0,'default',-1,'default',-1.0, \
                  'default','default','default',-1,-1,AcqHandle)
grab_image(Image,AcqHandle)
close_framegrabber(AcqHandle)

Result

If the parameter values are correct and the desired image acquisition device could be opened, open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber returns the value 2 ( H_MSG_TRUE) . Otherwise an exception is raised.

Possible Predecessors

info_framegrabberinfo_framegrabberInfoFramegrabberInfoFramegrabberinfo_framegrabber

Possible Successors

grab_imagegrab_imageGrabImageGrabImagegrab_image, grab_datagrab_dataGrabDataGrabDatagrab_data, grab_image_startgrab_image_startGrabImageStartGrabImageStartgrab_image_start, grab_image_asyncgrab_image_asyncGrabImageAsyncGrabImageAsyncgrab_image_async, grab_data_asyncgrab_data_asyncGrabDataAsyncGrabDataAsyncgrab_data_async, set_framegrabber_paramset_framegrabber_paramSetFramegrabberParamSetFramegrabberParamset_framegrabber_param, set_framegrabber_callbackset_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callback

See also

info_framegrabberinfo_framegrabberInfoFramegrabberInfoFramegrabberinfo_framegrabber, close_framegrabberclose_framegrabberCloseFramegrabberCloseFramegrabberclose_framegrabber, grab_imagegrab_imageGrabImageGrabImagegrab_image

Module

Foundation