set_framegrabber_callbackT_set_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callback (算子)

名称

set_framegrabber_callbackT_set_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callback — 为图像采集设备注册回调函数。

签名

set_framegrabber_callback( : : AcqHandle, CallbackType, CallbackFunction, UserContext : )

Herror T_set_framegrabber_callback(const Htuple AcqHandle, const Htuple CallbackType, const Htuple CallbackFunction, const Htuple UserContext)

void SetFramegrabberCallback(const HTuple& AcqHandle, const HTuple& CallbackType, const HTuple& CallbackFunction, const HTuple& UserContext)

void HFramegrabber::SetFramegrabberCallback(const HString& CallbackType, void* CallbackFunction, void* UserContext) const

void HFramegrabber::SetFramegrabberCallback(const char* CallbackType, void* CallbackFunction, void* UserContext) const

void HFramegrabber::SetFramegrabberCallback(const wchar_t* CallbackType, void* CallbackFunction, void* UserContext) const   ( Windows only)

static void HOperatorSet.SetFramegrabberCallback(HTuple acqHandle, HTuple callbackType, HTuple callbackFunction, HTuple userContext)

void HFramegrabber.SetFramegrabberCallback(string callbackType, IntPtr callbackFunction, IntPtr userContext)

def set_framegrabber_callback(acq_handle: HHandle, callback_type: str, callback_function: int, user_context: int) -> None

描述

算子 set_framegrabber_callbackset_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callback registers a callback function for the image acquisition device specified by AcqHandleAcqHandleAcqHandleAcqHandleacqHandleacq_handle. The parameter CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function contains a pointer to the function to register, while CallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackTypecallback_type specifies to which function of the underlying API the callback should be connected.

Suggested values for CallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackTypecallback_type are:

'exception':

The image acquisition has raised an exception.

'exposure_end':

The exposure of the next image has been finished.

'exposure_start':

The exposure of the next image has been started.

'transfer_end':

A new image is ready to be fetched by grab_image_asyncgrab_image_asyncGrabImageAsyncGrabImageAsyncGrabImageAsyncgrab_image_async

Depending on the functionality of the underlying API, additional values for CallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackTypecallback_type are possible. All actually supported callback types of a specific image acquisition device can be queried by calling get_framegrabber_paramget_framegrabber_paramGetFramegrabberParamGetFramegrabberParamGetFramegrabberParamget_framegrabber_param with the parameter 'available_callback_types'. For more details see the documentation of the specific image acquisition interface.

Once the callback is registered, on every occurrence of the underlying event (e.g., the notification that the exposure has finished) the specified callback function CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function will be called. If CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function is set to NULL, the corresponding callback will be unregistered.

The signature of the callback function is the following: Herror HAcqCallback(void *AcqHandle, void *Context, void *UserContext)

The first parameter of the callback function contains the handle to the image acquisition device passed in AcqHandleAcqHandleAcqHandleAcqHandleacqHandleacq_handle, the second one provides a pointer to interface-specific context data, and the third parameter is a user-specific pointer that is specified in UserContextUserContextUserContextUserContextuserContextuser_context

注意

For a multithreaded application, info_framegrabberinfo_framegrabberInfoFramegrabberInfoFramegrabberInfoFramegrabberinfo_framegrabber, open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber, and close_framegrabberclose_framegrabberCloseFramegrabberCloseFramegrabberCloseFramegrabberclose_framegrabber are executed exclusively.

set_framegrabber_callbackset_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callback runs in parallel with all non-exclusive operators inside and outside of this group.

执行信息

此算子修改后续输入参数的状态:

在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。

参数

AcqHandleAcqHandleAcqHandleAcqHandleacqHandleacq_handle (输入控制,状态被修改)  framegrabber HFramegrabber, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the acquisition device to be used.

CallbackTypeCallbackTypeCallbackTypeCallbackTypecallbackTypecallback_type (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Callback type.

默认值: 'transfer_end' "transfer_end" "transfer_end" "transfer_end" "transfer_end" "transfer_end"

建议值: 'exception'"exception""exception""exception""exception""exception", 'exposure_end'"exposure_end""exposure_end""exposure_end""exposure_end""exposure_end", 'exposure_start'"exposure_start""exposure_start""exposure_start""exposure_start""exposure_start", 'transfer_end'"transfer_end""transfer_end""transfer_end""transfer_end""transfer_end"

CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function (输入控制)  pointer HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Pointer to the callback function to be set.

UserContextUserContextUserContextUserContextuserContextuser_context (输入控制)  pointer HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Pointer to user-specific context data.

结果

If the image acquisition device is open and the specified callback was registered successfully, the operator set_framegrabber_callbackset_framegrabber_callbackSetFramegrabberCallbackSetFramegrabberCallbackSetFramegrabberCallbackset_framegrabber_callback 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。

可能的前趋

open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber, set_framegrabber_paramset_framegrabber_paramSetFramegrabberParamSetFramegrabberParamSetFramegrabberParamset_framegrabber_param

可能的后继

grab_imagegrab_imageGrabImageGrabImageGrabImagegrab_image, grab_datagrab_dataGrabDataGrabDataGrabDatagrab_data, grab_image_startgrab_image_startGrabImageStartGrabImageStartGrabImageStartgrab_image_start, grab_image_asyncgrab_image_asyncGrabImageAsyncGrabImageAsyncGrabImageAsyncgrab_image_async, grab_data_asyncgrab_data_asyncGrabDataAsyncGrabDataAsyncGrabDataAsyncgrab_data_async, get_framegrabber_paramget_framegrabber_paramGetFramegrabberParamGetFramegrabberParamGetFramegrabberParamget_framegrabber_param

另见

open_framegrabberopen_framegrabberOpenFramegrabberOpenFramegrabberOpenFramegrabberopen_framegrabber, get_framegrabber_callbackget_framegrabber_callbackGetFramegrabberCallbackGetFramegrabberCallbackGetFramegrabberCallbackget_framegrabber_callback

模块

基础