gramods
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | List of all members
gramods::gmTrack::OpenCvVideoCapture Class Reference

The OpenCvVideoCapture uses OpenCVs VideoCapture to read off video image data. More...

#include <OpenCvVideoCapture.hh>

Inheritance diagram for gramods::gmTrack::OpenCvVideoCapture:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmTrack::OpenCvVideoCapture:
Collaboration graph
[legend]

Classes

struct  Impl
 

Public Member Functions

void setVideoFile (std::filesystem::path file)
 Sets the video file to read from.
 
void setCameraId (int id)
 Sets the camera id to capture data from.
 
void setCameraWidth (int W)
 Sets the width of the resolution to request from the camera.
 
void setCameraHeight (int W)
 Sets the height of the resolution to request from the camera.
 
void setCameraFramerate (int R)
 Sets the framerate to request from the camera.
 
void setCameraFourCC (std::string cc)
 Specifies the FourCC for the camera stream.
 
void setBackend (std::string b)
 Specifies backend to use for reading camera or video stream.
 
void update (gmCore::Updateable::clock::time_point, size_t)
 Updates the video capture to read off the next frame.
 
bool retrieve (cv::Mat &image) override
 Retrieve the latest read image captured.
 
std::string getDefaultKey () override
 Returns the default key, in Configuration, for the Object.
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data.
 
virtual ~Object ()
 Cleaning up internal data.
 
virtual void initialize ()
 Called to initialize the Object.
 
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument.
 
virtual void traverse (Visitor *visitor)
 Calls the child Object's accept method, if such exist.
 
bool isInitialized ()
 Returns true if the Object is initialized.
 
- Public Member Functions inherited from gramods::gmCore::Updateable
 Updateable (int priority=0)
 Configures the Updateable properties to the specified priority.
 
virtual void update (clock::time_point t, size_t frame)=0
 Called by updateAll to make the object up-to-date.
 

Static Public Attributes

static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 

Additional Inherited Members

- Public Types inherited from gramods::gmCore::Updateable
typedef std::chrono::steady_clock clock
 
- Static Public Member Functions inherited from gramods::gmCore::Updateable
static void updateAll (clock::time_point t=clock::now(), std::optional< size_t > frame=std::nullopt)
 Updates all currently instanciated updateable objects.
 

Detailed Description

The OpenCvVideoCapture uses OpenCVs VideoCapture to read off video image data.

This class configures as an Updateable with a priority of

  1. Either Updateable::updateAll or update must be called at even intervals. This is done automatically by gm-load.

Member Function Documentation

◆ getDefaultKey()

std::string gramods::gmTrack::OpenCvVideoCapture::getDefaultKey ( )
inlineoverridevirtual

Returns the default key, in Configuration, for the Object.

Reimplemented from gramods::gmCore::Object.

◆ retrieve()

bool gramods::gmTrack::OpenCvVideoCapture::retrieve ( cv::Mat &  image)
override

Retrieve the latest read image captured.

Parameters
[out]imageThe latest image in the video source.
Returns
True if the image was successfully read.

◆ setBackend()

void gramods::gmTrack::OpenCvVideoCapture::setBackend ( std::string  b)

Specifies backend to use for reading camera or video stream.

Default is "ANY" and the following are all valid alternatives, though not all may be supported by the current build of OpenCV:

  • ANY
  • V4L
  • V4L2
  • FIREWIRE
  • FIREWARE
  • IEEE1394
  • DC1394
  • CMU1394
  • DSHOW
  • PVAPI
  • OPENNI
  • OPENNI_ASUS
  • ANDROID
  • XIAPI
  • AVFOUNDATION
  • GIGANETIX
  • MSMF
  • WINRT
  • INTELPERC
  • REALSENSE
  • OPENNI2
  • OPENNI2_ASUS
  • GPHOTO2
  • GSTREAMER
  • FFMPEG
  • IMAGES
  • ARAVIS
  • OPENCV_MJPEG
  • INTEL_MFX
  • XINE

XML-attribute: backend

◆ setCameraFourCC()

void gramods::gmTrack::OpenCvVideoCapture::setCameraFourCC ( std::string  cc)

Specifies the FourCC for the camera stream.

If not set the driver default is used. A value supported by many cameras is "MJPG". This string must be four characters long, so add spaces when necessary.

XML-attribute: cameraFourCC

◆ setCameraFramerate()

void gramods::gmTrack::OpenCvVideoCapture::setCameraFramerate ( int  R)

Sets the framerate to request from the camera.

If not set the driver default is used.

XML-attribute: cameraFramerate

See also
https://www.fourcc.org/codecs.php

◆ setCameraHeight()

void gramods::gmTrack::OpenCvVideoCapture::setCameraHeight ( int  W)

Sets the height of the resolution to request from the camera.

If not set the driver default is used.

XML-attribute: cameraHeight

◆ setCameraId()

void gramods::gmTrack::OpenCvVideoCapture::setCameraId ( int  id)

Sets the camera id to capture data from.

XML-attribute: cameraId

◆ setCameraWidth()

void gramods::gmTrack::OpenCvVideoCapture::setCameraWidth ( int  W)

Sets the width of the resolution to request from the camera.

If not set the driver default is used.

XML-attribute: cameraWidth

◆ setVideoFile()

void gramods::gmTrack::OpenCvVideoCapture::setVideoFile ( std::filesystem::path  file)

Sets the video file to read from.

XML-attribute: videoFile

◆ update()

void gramods::gmTrack::OpenCvVideoCapture::update ( gmCore::Updateable::clock::time_point  ,
size_t   
)

Updates the video capture to read off the next frame.


The documentation for this class was generated from the following files: