Skip to content

grab_image_asyncGrabImageAsyncGrabImageAsyncgrab_image_asyncT_grab_image_async🔗

Short description🔗

grab_image_asyncGrabImageAsyncGrabImageAsyncgrab_image_asyncT_grab_image_async — Asynchronous grab of an image from the specified image acquisition device.

Signature🔗

grab_image_async( out image Image, framegrabber AcqHandle, number MaxDelay )void GrabImageAsync( HObject* Image, const HTuple& AcqHandle, const HTuple& MaxDelay )static void HOperatorSet.GrabImageAsync( out HObject image, HTuple acqHandle, HTuple maxDelay )def grab_image_async( acq_handle: HHandle, max_delay: float ) -> HObject

Herror T_grab_image_async( Hobject* Image, const Htuple AcqHandle, const Htuple MaxDelay )

void HImage::GrabImageAsync( const HFramegrabber& AcqHandle, double MaxDelay )

HImage HFramegrabber::GrabImageAsync( double MaxDelay ) const

void HImage.GrabImageAsync( HFramegrabber acqHandle, double maxDelay )

HImage HFramegrabber.GrabImageAsync( double maxDelay )

Description🔗

The operator grab_image_asyncGrabImageAsync requests an asynchronously grabbed image from the image acquisition device specified by AcqHandleacqHandleacq_handle. By default, grab_image_asyncGrabImageAsync also starts the next asynchronous grab before the operator returns. More information about the behavior of a specific image acquisition device can be found in the corresponding interface documentation in the directory doc/html/reference/acquisition. The desired operational mode of the image acquisition device as well as a suitable image part and additional interface-specific settings can be specified using the operators open_framegrabberOpenFramegrabber and set_framegrabber_paramSetFramegrabberParam.

The grab is finished by calling grab_image_asyncGrabImageAsync or grab_data_asyncGrabDataAsync. If more than MaxDelaymaxDelaymax_delay ms have passed since the asynchronous grab was started, the asynchronously grabbed image is considered as too old and a new image is grabbed, if necessary. If a negative value is assigned to MaxDelaymaxDelaymax_delay, this control mechanism is deactivated.

To abort the grab, the operator set_framegrabber_paramSetFramegrabberParam with the parameter 'do_abort_grab' can be used if the specific image acquisition interface supports it. Note that as an exception from the description of the concurrent usage in multiple threads (see below) 'do_abort_grab' can also be used from another thread.

Please note that if you call the operators grab_imageGrabImage or grab_dataGrabData after grab_image_asyncGrabImageAsync, the asynchronous grab started by grab_image_asyncGrabImageAsync is aborted and a new synchronous grab is started.

Attention🔗

For a multithreaded application, info_framegrabberInfoFramegrabber, open_framegrabberOpenFramegrabber, and close_framegrabberCloseFramegrabber are executed exclusively.

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

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Imageimageimage (output_object) image → object (byte / int2)HObject (byte / int2)HImage (byte / int2)HObject (byte / int2)Hobject * (byte / int2)

Grabbed image.

AcqHandleacqHandleacq_handle (input_control) framegrabber → (handle)HTuple (HHandle)HFramegrabber, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the acquisition device to be used.

MaxDelaymaxDelaymax_delay (input_control) number → (real)HTuple (double)HTuple (double)floatHtuple (double)

Maximum tolerated delay between the start of the asynchronous grab and the delivery of the image [ms].

Default: -1.0-1.0
Suggested values: -1.0, 20.0, 33.3, 40.0, 66.6, 80.0, 99.9-1.0, 20.0, 33.3, 40.0, 66.6, 80.0, 99.9

Example🔗

(HDevelop)

* Select a suitable image acquisition interface named AcqName
open_framegrabber('AcqName', 1, 1, 0, 0, 0, 0, 'default' ,-1 , \
                  'default' ,-1.0, 'default', 'default', 'default', -1, \
                  -1, AcqHandle)
* Grab image + start next grab
grab_image_async(Image1, AcqHandle, -1.0)
* Process Image1 ...
* Finish asynchronous grab + start next grab
grab_image_async(Image2, AcqHandle, -1.0)
* Process Image2 ...
close_framegrabber(AcqHandle)

Result🔗

If the image acquisition device is open and supports asynchronous grabbing the operator grab_image_asyncGrabImageAsync returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

grab_image_startGrabImageStart, open_framegrabberOpenFramegrabber, set_framegrabber_paramSetFramegrabberParam

Possible successors

grab_data_asyncGrabDataAsync, set_framegrabber_paramSetFramegrabberParam, close_framegrabberCloseFramegrabber

See also

grab_image_startGrabImageStart, open_framegrabberOpenFramegrabber, info_framegrabberInfoFramegrabber, set_framegrabber_paramSetFramegrabberParam

Module🔗

Foundation