ImFusion C++ SDK 4.5.0
ImFusion::ImageStreamBuffer Class Referencethreadsafe

#include <ImFusion/Stream/ImageStreamBuffer.h>

This class buffers the last N seconds of an image stream and provides the buffered imaged as a SharedImageSet upon request. More...

Inheritance diagram for ImFusion::ImageStreamBuffer:

Detailed Description

This class buffers the last N seconds of an image stream and provides the buffered imaged as a SharedImageSet upon request.

The resulting frames can be further processed, displayed, or saved (e.g. to a video file).

Example:

#include <ImFusion/IO/VideoIoAlgorithm.h>
#include <ImFusion/Stream/ImageStreamBuffer.h>
// set up buffer to cache the last two seconds
buffer->setBufferTime(std::chrono::seconds(10));
// ... (other code until buffered images are requested)
// obtain cached images at any time
auto images = buffer->freezeBuffer();
// process images (e.g. save to video file)
VideoIoAlgorithm videoExport{*images};
videoExport.setLocation("C:/Temp/test.mp4");
videoExport.compute();
Specialization of Stream for streams producing 2D or 3D images.
Definition ImageStream.h:22
virtual void setLocation(const std::string &location)
Set location for subsequent loading/saving.
Algorithm for reading video files as image set, and writing them.
Definition VideoIoAlgorithm.h:14
void compute() override
Execute the algorithm.
T make_unique(T... args)
Note
Threadsafe class: Member functions can be called concurrently from any thread.

Public Member Functions

 ImageStreamBuffer (ImageStream &stream)
std::unique_ptr< SharedImageSetfreezeBuffer ()
 Returns the last N seconds (specified by setCachingTime) of the Buffer It caches the first image if the image stream data contains multiple images.
void setBufferTime (std::chrono::duration< double > duration)
 Configure the buffer length (in seconds).
std::chrono::duration< double > bufferTime () const
 Get the buffer length (in seconds).
Public Member Functions inherited from ImFusion::SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.

Additional Inherited Members

Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.

Member Function Documentation

◆ freezeBuffer()

std::unique_ptr< SharedImageSet > ImFusion::ImageStreamBuffer::freezeBuffer ( )
threadsafe

Returns the last N seconds (specified by setCachingTime) of the Buffer It caches the first image if the image stream data contains multiple images.

as a SharedImageSet

Can be called concurrently from any thread.

◆ setBufferTime()

void ImFusion::ImageStreamBuffer::setBufferTime ( std::chrono::duration< double > duration)
threadsafe

Configure the buffer length (in seconds).

Can be called concurrently from any thread.

◆ bufferTime()

std::chrono::duration< double > ImFusion::ImageStreamBuffer::bufferTime ( ) const
threadsafe

Get the buffer length (in seconds).

Can be called concurrently from any thread.


The documentation for this class was generated from the following file:
  • ImFusion/Stream/ImageStreamBuffer.h
Search Tab / S to search, Esc to close