ITK  5.4.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
itk::OpenCVVideoCapture< TVideoStream > Class Template Reference

#include <itkOpenCVVideoCapture.h>

Detailed Description

template<typename TVideoStream>
class itk::OpenCVVideoCapture< TVideoStream >

This class implements OpenCV's VideoCapture API and takes an itk VideoStream as input.

This implementation of cv::VideoCapture provides the additional method open( itk::VideoStream* ) to "open" video data from an ITK pipeline. The traditional open methods will throw exceptions, so it can only be used to access the output of an ITK video pipeline from an OpenCV capture context.

Definition at line 51 of file itkOpenCVVideoCapture.h.

+ Inheritance diagram for itk::OpenCVVideoCapture< TVideoStream >:
+ Collaboration diagram for itk::OpenCVVideoCapture< TVideoStream >:

Public Types

using FrameType = typename VideoStreamType::FrameType
 
using PixelType = typename FrameType::PixelType
 
using Self = OpenCVVideoCapture< VideoStreamType >
 
using VideoStreamType = TVideoStream
 

Public Member Functions

virtual double get (int propId)
 
virtual const char * GetNameOfClass () const
 
virtual bool grab ()
 
virtual bool isOpened () const
 
virtual bool open (const std::string &)
 
virtual bool open (int)
 
virtual bool open (VideoStreamType *videoStream)
 
 OpenCVVideoCapture ()
 
 OpenCVVideoCapture (VideoStreamType *videoStream)
 
virtual Selfoperator>> (cv::Mat &image)
 
virtual bool read (cv::Mat &image)
 
virtual void release ()
 
virtual bool retrieve (cv::Mat &image, int channel=0)
 
virtual bool set (int propId, double value)
 
virtual ~OpenCVVideoCapture ()
 

Static Public Attributes

static constexpr unsigned int Dimensions = FrameType::ImageDimension
 

Protected Attributes

int m_FourCC {}
 
double m_FpS {}
 
VideoStreamTypem_VideoStream {}
 

Member Typedef Documentation

◆ FrameType

template<typename TVideoStream >
using itk::OpenCVVideoCapture< TVideoStream >::FrameType = typename VideoStreamType::FrameType

Definition at line 56 of file itkOpenCVVideoCapture.h.

◆ PixelType

template<typename TVideoStream >
using itk::OpenCVVideoCapture< TVideoStream >::PixelType = typename FrameType::PixelType

Definition at line 57 of file itkOpenCVVideoCapture.h.

◆ Self

template<typename TVideoStream >
using itk::OpenCVVideoCapture< TVideoStream >::Self = OpenCVVideoCapture<VideoStreamType>

Definition at line 55 of file itkOpenCVVideoCapture.h.

◆ VideoStreamType

template<typename TVideoStream >
using itk::OpenCVVideoCapture< TVideoStream >::VideoStreamType = TVideoStream

Definition at line 54 of file itkOpenCVVideoCapture.h.

Constructor & Destructor Documentation

◆ OpenCVVideoCapture() [1/2]

template<typename TVideoStream >
itk::OpenCVVideoCapture< TVideoStream >::OpenCVVideoCapture ( )

Constructor that initializes internal VideoStream to null

◆ OpenCVVideoCapture() [2/2]

template<typename TVideoStream >
itk::OpenCVVideoCapture< TVideoStream >::OpenCVVideoCapture ( VideoStreamType videoStream)

Constructor that takes a VideoStream as input

◆ ~OpenCVVideoCapture()

template<typename TVideoStream >
virtual itk::OpenCVVideoCapture< TVideoStream >::~OpenCVVideoCapture ( )
inlinevirtual

Destructor that does nothing. The VideoStream will be freed by the source that generated it.

Definition at line 68 of file itkOpenCVVideoCapture.h.

Member Function Documentation

◆ get()

template<typename TVideoStream >
virtual double itk::OpenCVVideoCapture< TVideoStream >::get ( int  propId)
virtual

Get a property

◆ GetNameOfClass()

template<typename TVideoStream >
virtual const char* itk::OpenCVVideoCapture< TVideoStream >::GetNameOfClass ( ) const
virtual

◆ grab()

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::grab ( )
virtual

Grab the next frame from the VideoStream

◆ isOpened()

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::isOpened ( ) const
inlinevirtual

Check if the VideoStream is null

Definition at line 99 of file itkOpenCVVideoCapture.h.

◆ open() [1/3]

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::open ( const std::string &  )
inlinevirtual

overload reading from file and camera just to throw exceptions

Definition at line 77 of file itkOpenCVVideoCapture.h.

◆ open() [2/3]

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::open ( int  )
inlinevirtual

Definition at line 85 of file itkOpenCVVideoCapture.h.

◆ open() [3/3]

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::open ( VideoStreamType videoStream)
virtual

Add an open method that takes a TemporalDataObject. This checks to make sure that it can be cast to a VideoStream

◆ operator>>()

template<typename TVideoStream >
virtual Self& itk::OpenCVVideoCapture< TVideoStream >::operator>> ( cv::Mat &  image)
virtual

Stream the next frame into the provided image. Equivalent to grab() + retrieve(image, 0)

◆ read()

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::read ( cv::Mat &  image)
virtual

Non-operator version of >>'s functionality

◆ release()

template<typename TVideoStream >
virtual void itk::OpenCVVideoCapture< TVideoStream >::release ( )
virtual

Just set the internal pointer to null. Let the upstream filters take care of actually freeing the memory

◆ retrieve()

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::retrieve ( cv::Mat &  image,
int  channel = 0 
)
virtual

Access the current frame of the VideoStream

◆ set()

template<typename TVideoStream >
virtual bool itk::OpenCVVideoCapture< TVideoStream >::set ( int  propId,
double  value 
)
virtual

Set a property

Member Data Documentation

◆ Dimensions

template<typename TVideoStream >
constexpr unsigned int itk::OpenCVVideoCapture< TVideoStream >::Dimensions = FrameType::ImageDimension
staticconstexpr

Definition at line 58 of file itkOpenCVVideoCapture.h.

◆ m_FourCC

template<typename TVideoStream >
int itk::OpenCVVideoCapture< TVideoStream >::m_FourCC {}
protected

Definition at line 144 of file itkOpenCVVideoCapture.h.

◆ m_FpS

template<typename TVideoStream >
double itk::OpenCVVideoCapture< TVideoStream >::m_FpS {}
protected

Property members

Definition at line 143 of file itkOpenCVVideoCapture.h.

◆ m_VideoStream

template<typename TVideoStream >
VideoStreamType* itk::OpenCVVideoCapture< TVideoStream >::m_VideoStream {}
protected

Internal VideoStream

Definition at line 140 of file itkOpenCVVideoCapture.h.


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