You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto it = ic4_examples::console::select_from_list(device_list);
if (it == device_list.end())
{
return -1;
}
// Open the selected device
ic4::Error err;
ic4::Grabber grabber;
if (!grabber.deviceOpen(*it, err))
{
std::cerr << "Failed to open device: " << err.message() << std::endl;
return -2;
}
To get access to the image data received from the device, we have to create a sink object.
Since we want to record a video file of a portion of the data stream from the video capture device,
we need to access all image buffers that are received from the device during the time of recording.
The QueueSink is the perfect solution in this situation.
To use a QueueSink, a class has to be derived from QueueSinkListener that handles sink events, especially QueueSinkListener::framesQueued:
A new video file is started by a call to VideoWriter::beginFile. The function expects a file name, the format of the buffers that are going to be fed into VideoWriter::addFrame, and
the video file's playback rate:
In our queue sink's framesQueued callback function, the oldest available image buffer is extracted from the sink's output queue. Is important to
always pop and ultimately requeue the buffers to not starve the drivers of image buffers, even if the program does not always use the buffers: