Imaging Control 4 C++ Library 1.2.0
|
Represents an opened video capture device, allowing device configuration and stream setup. More...
Classes | |
struct | StreamStatistics |
Contains statistics counters that can be used to analyze the stream behavior and identify possible bottlenecks. More... | |
Public Types | |
using | NotificationToken = void * |
Represents a registered callback. | |
using | DeviceLostHandler = std::function< void(Grabber &grabber)> |
Function prototype for device-lost event handlers. | |
Public Member Functions | |
Grabber (Error &err=Error::Default()) | |
Creates a new grabber. | |
Grabber (const DeviceInfo &dev, Error &err=Error::Default()) | |
Creates a new grabber and opens the specified video capture device. | |
Grabber (const char *identifier, Error &err=Error::Default()) | |
Creates a new grabber and opens the specified video capture device. | |
Grabber (const std::string &identifier, Error &err=Error::Default()) | |
Creates a new grabber and opens the specified video capture device. | |
bool | is_valid () const noexcept |
Checks whether this grabber is a valid object. | |
bool | deviceOpen (const DeviceInfo &dev, Error &err=Error::Default()) |
Opens the video capture device specified by the passed device information object. | |
bool | deviceOpen (const char *identifier, Error &err=Error::Default()) |
Opens the video capture matching the specified identifier. | |
bool | deviceOpen (const std::string &identifier, Error &err=Error::Default()) |
Opens the video capture matching the specified identifier. | |
bool | deviceOpenFromState (const std::vector< uint8_t > &device_state, Error &err=Error::Default()) |
Restores the opened device and its settings from a memory buffer containing data that was previously written by Grabber::deviceSaveState(Error&). | |
bool | deviceOpenFromState (const char *file_path, Error &err=Error::Default()) |
Restores the opened device and its settings from a file that was previously written by Grabber::deviceSaveState(const char*, Error&). | |
bool | deviceOpenFromState (const std::string &file_path, Error &err=Error::Default()) |
Restores the opened device and its settings from a file that was previously written by Grabber::deviceSaveState(const std::string&, Error&). | |
bool | streamSetup (const std::shared_ptr< Sink > &sink, const std::shared_ptr< Display > &display, StreamSetupOption action=StreamSetupOption::AcquisitionStart, Error &err=Error::Default()) |
Establishes the data stream from the device. | |
bool | streamSetup (const std::shared_ptr< Sink > &sink, StreamSetupOption action=StreamSetupOption::AcquisitionStart, Error &err=Error::Default()) |
Establishes the data stream from the device. | |
bool | streamSetup (const std::shared_ptr< Display > &display, StreamSetupOption action=StreamSetupOption::AcquisitionStart, Error &err=Error::Default()) |
Establishes the data stream from the device. | |
std::shared_ptr< Sink > | sink (Error &err=Error::Default()) const |
Returns a shared_ptr to the sink object that was passed to Grabber::streamSetup() when setting up the currently established data stream. | |
std::shared_ptr< Display > | display (Error &err=Error::Default()) const |
Returns a shared_ptr to the display object that was passed to Grabber::streamSetup() when setting up the currently established data stream. | |
bool | isStreaming () const |
Checks whethere there is a data stream established from this grabber's video capture device. | |
bool | acquisitionStart (Error &err=Error::Default()) |
Starts the acquisition of images from the video capture device. | |
bool | acquisitionStop (Error &err=Error::Default()) |
Stops the acquisition of images from the video capture device. | |
bool | streamStop (Error &err=Error::Default()) |
Stops a data stream that was previously set up by a call to Grabber::streamSetup(). | |
bool | isAcquisitionActive () const |
Checks whether image acquisition is currently enabled for this grabber's video capture device. | |
bool | isDeviceOpen () const |
Checks whether the grabber currently has an opened video capture device. | |
DeviceInfo | deviceInfo (Error &err=Error::Default()) const |
Returns information about the currently opened video capture device. | |
bool | isDeviceValid () const |
Checks whether the grabber's currently opened video capture device is ready to use. | |
bool | deviceClose (Error &err=Error::Default()) |
Closes the video capture device currently opened by this grabber instance. | |
PropertyMap | devicePropertyMap (Error &err=Error::Default()) const |
Returns the property map for the currently opened video capture device. | |
PropertyMap | driverPropertyMap (Error &err=Error::Default()) const |
Returns the property map for the driver of the currently opened video capture device. | |
StreamStatistics | streamStatistics (Error &err=Error::Default()) |
Query statistics counters from the currently running or previously stopped data stream. | |
std::vector< uint8_t > | deviceSaveState (Error &err=Error::Default()) |
Saves the currently opened video capture device and all its settings into a memory buffer. | |
bool | deviceSaveState (const std::string &file_path, Error &err=Error::Default()) |
Saves the currently opened video capture device and all its settings into a file. | |
bool | deviceSaveState (const char *file_path, Error &err=Error::Default()) |
Saves the currently opened video capture device and all its settings into a file. | |
NotificationToken | eventAddDeviceLost (DeviceLostHandler cb, Error &err=Error::Default()) |
Registers a new device-lost event handler. | |
bool | eventRemoveDeviceLost (NotificationToken token, Error &err=Error::Default()) |
Unregisters a device-lost event handler. | |
Represents an opened video capture device, allowing device configuration and stream setup.
The grabber object is the core component used when working with video capture devices.
Grabber objects are created using the constructor Grabber::Grabber(Error&).
After creation, the most common operation on a grabber is to open a device. Call Grabber::deviceOpen() or one of its siblings. A device can also be selected and configured by calling Grabber::deviceOpenFromState().
To establish a data stream from the opened video capture device, call Grabber::streamSetup(), specifying a sink and/or a display.
A Sink is required if the program needs to access, process, or store image data. There are several sink types available to choose from, which are useful depending on the application, e.g. QueueSink or SnapSink.
A Display can be used to automatically display all images received from a video capture device.
After the data stream has been set up, call Grabber::acquisitionStart() to begin the transfer of images.
Graber objects are movable.
using DeviceLostHandler = std::function<void(Grabber& grabber)> |
Function prototype for device-lost event handlers.
[in] | grabber | The grabber on which the event handler was registered. |
using NotificationToken = void* |
Represents a registered callback.
When a callback function is registered using Grabber::eventAddDeviceLost, a token is returned.
The token can then be used to remove the callback using Grabber::eventRemoveDeviceLost at a later time.
|
inline |
Creates a new grabber.
[out] | err | Reference to an error handler. See Error Handling for details. |
err
is not configured to throw, and the constructor fails, the grabber object is in an invalid state. All member function calls will fail.
|
inlineexplicit |
Creates a new grabber and opens the specified video capture device.
[in] | dev | A device information object representing the video capture device to be opened |
[out] | err | Reference to an error handler. See Error Handling for details. |
err
is not configured to throw, and the grabber object could not be created, the object will be in an invalid state. All member function calls will fail.
|
inlineexplicit |
Creates a new grabber and opens the specified video capture device.
[in] | identifier | The model name, unique name or serial of a connected video capture device |
[out] | err | Reference to an error handler. See Error Handling for details. |
err
is not configured to throw, and the grabber object could not be created, the object will be in an invalid state. All member function calls will fail.
|
inlineexplicit |
Creates a new grabber and opens the specified video capture device.
[in] | identifier | The model name, unique name or serial of a connected video capture device |
[out] | err | Reference to an error handler. See Error Handling for details. |
err
is not configured to throw, and the grabber object could not be created, the object will be in an invalid state. All member function calls will fail.
|
inline |
Starts the acquisition of images from the video capture device.
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.AcquisitionStart
command on the video capture device's property map.
|
inline |
Stops the acquisition of images from the video capture device.
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.AcquisitionStop
command on the video capture device's property map.
|
inline |
Closes the video capture device currently opened by this grabber instance.
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Returns information about the currently opened video capture device.
[out] | err | Reference to an error handler. See Error Handling for details. |
err
output parameter or PropertyMap::is_valid().
|
inline |
Opens the video capture matching the specified identifier.
[in] | identifier | The model name, unique name, serial, user id, IPV4 address or MAC address of a connected video capture device |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Opens the video capture device specified by the passed device information object.
[in] | dev | A device information object representing the video capture device to be opened |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Opens the video capture matching the specified identifier.
[in] | identifier | The model name, unique name or serial of a connected video capture device |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Restores the opened device and its settings from a file that was previously written by Grabber::deviceSaveState(const char*, Error&).
[in] | file_path | Path to a file containing device state information |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Restores the opened device and its settings from a file that was previously written by Grabber::deviceSaveState(const std::string&, Error&).
[in] | file_path | Path to a file containing device state information |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Restores the opened device and its settings from a memory buffer containing data that was previously written by Grabber::deviceSaveState(Error&).
[in] | device_state | A buffer containing data that was written by Grabber::deviceSaveState(Error&). |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Returns the property map for the currently opened video capture device.
The property map returned from this function is the origin for all device feature manipulation operations.
[out] | err | Reference to an error handler. See Error Handling for details. |
err
output parameter or PropertyMap::is_valid().
|
inline |
Saves the currently opened video capture device and all its settings into a file.
file_path | Path to a file that the device stats is written to | |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Saves the currently opened video capture device and all its settings into a file.
file_path | Path to a file that the device stats is written to | |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Saves the currently opened video capture device and all its settings into a memory buffer.
[out] | err | Reference to an error handler. See Error Handling for details. |
|
inline |
Returns a shared_ptr
to the display object that was passed to Grabber::streamSetup() when setting up the currently established data stream.
[out] | err | Reference to an error handler. See Error Handling for details. |
shared_ptr
to the display object, or nullptr
if an error occurred.err
output parameter for details.
|
inline |
Returns the property map for the driver of the currently opened video capture device.
The property map returned from this function is the origin for driver-related feature operations.
[out] | err | Reference to an error handler. See Error Handling for details. |
err
output parameter or PropertyMap::is_valid().
|
inline |
Registers a new device-lost event handler.
[in] | cb | Callback function to be called when the connection to the currently opened device ist lost. |
[out] | err | Reference to an error handler. See Error Handling for details. |
nullptr
.
|
inline |
Unregisters a device-lost event handler.
[in] | token | A token that was returned when registering an event handler using Grabber::eventAddDeviceLost(). |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inlinenoexcept |
Checks whether this grabber is a valid object.
If there is an error in the constructor, and function was not configured to throw on error, an invalid object is created. All member function calls will fail.
true
, if this grabber was constructed successfully, otherwise false
.
|
inline |
Checks whether image acquisition is currently enabled for this grabber's video capture device.
true
, if image acquisition is currently active, otherwise false
.
|
inline |
Checks whether the grabber currently has an opened video capture device.
true
, if the grabber has an opened video capture device, otherwise false
.
|
inline |
Checks whether the grabber's currently opened video capture device is ready to use.
true
, if the grabber has an opened video capture device that is ready to use, otherwise false
.false:
|
inline |
Checks whethere there is a data stream established from this grabber's video capture device.
true
, if a data stream was previously established by calling Grabber::streamSetup().false
.
|
inline |
Returns a shared_ptr
to the sink object that was passed to Grabber::streamSetup() when setting up the currently established data stream.
[out] | err | Reference to an error handler. See Error Handling for details. |
shared_ptr
to the sink object, or nullptr
if an error occurred.err
output parameter for details.
|
inline |
Establishes the data stream from the device.
A data stream is required for image acquisition from the video capture device, and must include a Sink, a Display, or both.
[in] | display | A display to display images |
[in] | action | Specifies whether to immediately start acquisition after the data stream was set up successfully |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Establishes the data stream from the device.
A data stream is required for image acquisition from the video capture device, and must include a Sink, a Display, or both.
[in] | sink | A sink to receive the images |
[in] | display | A display to display images |
[in] | action | Specifies whether to immediately start acquisition after the data stream was set up successfully |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Establishes the data stream from the device.
A data stream is required for image acquisition from the video capture device, and must include a Sink, a Display, or both.
[in] | sink | A sink to receive the images |
[in] | action | Specifies whether to immediately start acquisition after the data stream was set up successfully |
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.
|
inline |
Query statistics counters from the currently running or previously stopped data stream.
[out] | err | Reference to an error handler. See Error Handling for details. |
|
inline |
Stops a data stream that was previously set up by a call to Grabber::streamSetup().
[out] | err | Reference to an error handler. See Error Handling for details. |
true
on success, otherwise false
.