ifm3dpy.framegrabber.FrameGrabber

class ifm3dpy.framegrabber.FrameGrabber

Bases: None

Implements a TCP FrameGrabber connected to a provided Camera

__init__(self: ifm3dpy.framegrabber.FrameGrabber, cam: ifm3dpy.device.Device, pcic_port: Optional[int] = None) None

Constructor

Parameters
  • cam (ifm3dpy.Camera) – The camera instance to grab frames from.

  • pcic_port (uint16) – The PCIC port

Methods

__init__(self, cam[, pcic_port])

Constructor

is_masking(self)

rtype

Masking flag

is_running(self)

Returns true if the worker thread is currently running

on_async_error(self[, callback])

This function will enable the async error messages on device.

on_async_notification(self[, callback])

This function will enable the async notifications on device.

on_error(self[, callback])

The callback will be executed whenever an error condition occur while grabbing the data from device.

on_new_frame(self[, callback])

The callback will be executed whenever a new frame is available.

set_masking(self, arg0)

Enable/Disable masking on supported buffers Note: ifm3dpy.buffer_id.CONFIDENCE_IMAGE should be in schema list passed to ifm3dpy.FrameGrabber.Start method

start(self[, buffers, pcic_format])

Starts the worker thread for streaming in pixel data from the device

stop(self)

Stops the worker thread for streaming in pixel data from the device

sw_trigger(self)

Triggers the device for image acquisition

wait_for_frame(self)

Returns an Awaitable that will resolve when a new frame is available

is_masking(self: ifm3dpy.framegrabber.FrameGrabber) bool
Return type

Masking flag

is_running(self: ifm3dpy.framegrabber.FrameGrabber) bool

Returns true if the worker thread is currently running

on_async_error(self: ifm3dpy.framegrabber.FrameGrabber, callback: Callable[[int, str], None] = None) None

This function will enable the async error messages on device. The callback will be executed whenever a async error are avaliable. It receives a error code and error string to the received async error as an argument.

on_async_notification(self: ifm3dpy.framegrabber.FrameGrabber, callback: Callable[[str, str], None] = None) None

This function will enable the async notifications on device. The callback will be executed whenever a async notification is avaliable. It receives a message id and payload string

on_error(self: ifm3dpy.framegrabber.FrameGrabber, callback: Callable[[ifm3dpy.device.Error], None] = None) None

The callback will be executed whenever an error condition occur while grabbing the data from device.

on_new_frame(self: ifm3dpy.framegrabber.FrameGrabber, callback: Callable[[ifm3dpy.framegrabber.Frame], None] = None) None

The callback will be executed whenever a new frame is available. It receives the frame as an argument.

set_masking(self: ifm3dpy.framegrabber.FrameGrabber, arg0: bool) None

Enable/Disable masking on supported buffers Note: ifm3dpy.buffer_id.CONFIDENCE_IMAGE should be in schema list passed to ifm3dpy.FrameGrabber.Start method

Parameters

mask – flag to enable/disable masking.

start(self: ifm3dpy.framegrabber.FrameGrabber, buffers: Sequence[Union[int, ifm3dpy.framegrabber.buffer_id]] = [], pcic_format: Optional[dict] = None) ifm3dpy.Awaitable

Starts the worker thread for streaming in pixel data from the device

Returns

Resolves when framegrabber is ready to receive frames.

Return type

FutureAwaitable

Parameters
  • buffers (List[uint64]) – A List of buffer_ids for receiving, passing in an List set will received all available images. The buffer_ids are specific to the current Organizer. See buffer_id for a list of buffer_ids available with the default Organizer

  • pcicFormat (Dict) –

    allows to manually set a PCIC pcicFormat for asynchronous results. See ifm3d::make_schema for generation logic of the default pcicFormat. Manually setting the pcicFormat should rarely be needed and most usecases should be covered by the default generated pcicFormat.

    Note: The FrameGrabber is relying on some specific formatting rules, if they are missing from the pcicFormat the FrameGrabber will not be able to extract the image data.

stop(self: ifm3dpy.framegrabber.FrameGrabber) ifm3dpy.Awaitable

Stops the worker thread for streaming in pixel data from the device

Returns

Resolves when framgrabber stops.

Return type

FutureAwaitable

sw_trigger(self: ifm3dpy.framegrabber.FrameGrabber) ifm3dpy.Awaitable

Triggers the device for image acquisition

You should be sure to set the TriggerMode for your application to SW in order for this to be effective. This function simply does the triggering, data are still received asynchronously via wait_for_frame().

Calling this function when the device is not in SW trigger mode or on a device that does not support software-trigger should result in a NOOP and no error will be returned (no exceptions thrown). However, we do not recommend calling this function in a tight framegrabbing loop when you know it is not needed. The “cost” of the NOOP is undefined and incurring it is not recommended.

wait_for_frame(self: ifm3dpy.framegrabber.FrameGrabber) ifm3dpy.FrameAwaitable

Returns an Awaitable that will resolve when a new frame is available