Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::OpenCVVideoSource Class Reference

#include <mitkOpenCVVideoSource.h>

Inheritance diagram for mitk::OpenCVVideoSource:
Collaboration diagram for mitk::OpenCVVideoSource:

Public Types

typedef itk::RGBPixel< unsigned char > CharPixelType
 
typedef itk::FixedArray< float, 3 > HSVPixelType
 
typedef itk::Image< CharPixelType, 2 > RGBPixelImageType
 
typedef itk::Image< HSVPixelType, 2 > HSVPixelImageType
 
typedef itk::ImageRegionIterator< RGBPixelImageTypeRGBConstIteratorType
 
typedef itk::ImageRegionIterator< HSVPixelImageTypeHSVConstIteratorType
 

Public Member Functions

 mitkClassMacro (OpenCVVideoSource, VideoSource)
 
Pointer Clone () const
 
virtual void SetVideoFileInput (const char *filename, bool repeatVideo, bool useCVCAMLib=false)
 
virtual void SetVideoCameraInput (int cameraindex, bool useCVCAMLib=false)
 
virtual double GetVideoCaptureProperty (int property_id)
 
virtual int SetVideoCaptureProperty (int property_id, double value)
 
virtual void GetCurrentFrameAsOpenCVImage (IplImage *image)
 
virtual cv::Mat GetImage () override
 
virtual const IplImage * GetCurrentFrame ()
 
virtual void GetCurrentFrameAsItkHSVPixelImage (HSVPixelImageType::Pointer &Image)
 
virtual void FetchFrame () override
 
virtual unsigned char * GetVideoTexture () override
 
virtual void StartCapturing () override
 
virtual void StopCapturing () override
 
virtual IplImage * FlipImage (IplImage *input)
 
virtual void EnableOnlineImageUndistortion (mitk::Point3D focal, mitk::Point3D principal, mitk::Point4D distortion)
 
virtual void DisableOnlineImageUndistortion ()
 
virtual bool OnlineImageUndistortionEnabled () const
 
virtual void PauseCapturing () override
 
virtual std::string GetVideoFileName () const
 
virtual void SetEnableXAxisFlip (bool enable)
 
virtual void SetEnableYAxisFlip (bool enable)
 
virtual short GetGrabbingDeviceNumber () const
 
virtual bool GetRepeatVideo ()
 
virtual void SetRepeatVideo (bool _arg)
 
- Public Member Functions inherited from mitk::VideoSource
 mitkClassMacroItkParent (VideoSource, itk::Object)
 
virtual bool IsCapturingEnabled () const
 
virtual int GetImageWidth ()
 
virtual int GetImageHeight ()
 
virtual unsigned long GetFrameCount () const
 
virtual bool GetCapturePaused () const
 
- Public Member Functions inherited from mitk::OpenCVImageSource
 mitkClassMacroItkParent (OpenCVImageSource, itk::Object)
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 OpenCVVideoSource ()
 
virtual ~OpenCVVideoSource ()
 
void Reset ()
 
void UpdateVideoTexture ()
 
void sleep (unsigned int ms)
 
void RGBtoHSV (float r, float g, float b, float &h, float &s, float &v)
 
- Protected Member Functions inherited from mitk::VideoSource
 VideoSource ()
 
virtual ~VideoSource ()
 

Protected Attributes

CvCapture * m_VideoCapture
 
IplImage * m_CurrentImage
 
unsigned char * m_CurrentVideoTexture
 
IplImage * m_PauseImage
 
std::string m_VideoFileName
 saves the video file name (is empty if a grabbing device is used or if this is not initialized) More...
 
short m_GrabbingDeviceNumber
 saves the grabbing device number (is -1 if a videofilename is used or if this is not initialized) More...
 
bool m_RepeatVideo
 
bool m_UseCVCAMLib
 
bool m_UndistortImage
 
mitk::UndistortCameraImage::Pointer m_UndistortCameraImage
 
bool m_FlipXAxisEnabled
 
bool m_FlipYAxisEnabled
 
- Protected Attributes inherited from mitk::VideoSource
unsigned char * m_CurrentVideoTexture
 
int m_CaptureWidth
 
int m_CaptureHeight
 
bool m_CapturingInProcess
 
unsigned long m_FrameCount
 
bool m_CapturePaused
 

Detailed Description

Interface for acquiring video data using Intel's OPENCV library. Video data may either be provided from a file or a grabbing device. At the moment, OPENCV includes two separated modules for this grabbing, but only HighGui is used here. Initialize via SetVideoFileInput() or SetVideoCameraInput(), start processing with StartCapturing();

Definition at line 43 of file mitkOpenCVVideoSource.h.

Member Typedef Documentation

typedef itk::RGBPixel< unsigned char > mitk::OpenCVVideoSource::CharPixelType

Definition at line 47 of file mitkOpenCVVideoSource.h.

Definition at line 52 of file mitkOpenCVVideoSource.h.

typedef itk::FixedArray<float,3> mitk::OpenCVVideoSource::HSVPixelType

Definition at line 48 of file mitkOpenCVVideoSource.h.

Definition at line 51 of file mitkOpenCVVideoSource.h.

Constructor & Destructor Documentation

mitk::OpenCVVideoSource::OpenCVVideoSource ( )
protected

Definition at line 21 of file mitkOpenCVVideoSource.cpp.

mitk::OpenCVVideoSource::~OpenCVVideoSource ( )
protectedvirtual

Definition at line 35 of file mitkOpenCVVideoSource.cpp.

Member Function Documentation

Pointer mitk::OpenCVVideoSource::Clone ( ) const
void mitk::OpenCVVideoSource::DisableOnlineImageUndistortion ( )
virtual

Definition at line 266 of file mitkOpenCVVideoSource.cpp.

void mitk::OpenCVVideoSource::EnableOnlineImageUndistortion ( mitk::Point3D  focal,
mitk::Point3D  principal,
mitk::Point4D  distortion 
)
virtual

Definition at line 252 of file mitkOpenCVVideoSource.cpp.

References mitk::UndistortCameraImage::New().

void mitk::OpenCVVideoSource::FetchFrame ( )
overridevirtual

assigns the grabbing devices for acquiring the next frame. in this base implementation it does nothing except incrementing m_FrameCount

Reimplemented from mitk::VideoSource.

Reimplemented in mitk::VideoInputSource.

Definition at line 121 of file mitkOpenCVVideoSource.cpp.

References MITK_DEBUG, and MITK_INFO.

IplImage * mitk::OpenCVVideoSource::FlipImage ( IplImage *  input)
virtual

Definition at line 366 of file mitkOpenCVVideoSource.cpp.

const IplImage * mitk::OpenCVVideoSource::GetCurrentFrame ( )
virtual
void mitk::OpenCVVideoSource::GetCurrentFrameAsItkHSVPixelImage ( HSVPixelImageType::Pointer &  Image)
virtual

Definition at line 272 of file mitkOpenCVVideoSource.cpp.

void mitk::OpenCVVideoSource::GetCurrentFrameAsOpenCVImage ( IplImage *  image)
virtual

Definition at line 109 of file mitkOpenCVVideoSource.cpp.

virtual short mitk::OpenCVVideoSource::GetGrabbingDeviceNumber ( ) const
virtual

Returns the GrabbingDeviceNumber (maybe -1 if a video file is used)

Referenced by QmitkOpenCVVideoControls::SetVideoBackground().

cv::Mat mitk::OpenCVVideoSource::GetImage ( void  )
overridevirtual
Returns
a copy of the image as opencv 2 Mat

Implements mitk::OpenCVImageSource.

Definition at line 94 of file mitkOpenCVVideoSource.cpp.

virtual bool mitk::OpenCVVideoSource::GetRepeatVideo ( )
virtual
double mitk::OpenCVVideoSource::GetVideoCaptureProperty ( int  property_id)
virtual
virtual std::string mitk::OpenCVVideoSource::GetVideoFileName ( ) const
virtual

Returns the video file name (maybe empty if a grabbing device is used)

Referenced by QmitkOpenCVVideoControls::SetVideoBackground().

unsigned char * mitk::OpenCVVideoSource::GetVideoTexture ( )
overridevirtual
Returns
a pointer to the image data array for opengl rendering.

Implements mitk::VideoSource.

Definition at line 77 of file mitkOpenCVVideoSource.cpp.

mitk::OpenCVVideoSource::mitkClassMacro ( OpenCVVideoSource  ,
VideoSource   
)
static Pointer mitk::OpenCVVideoSource::New ( )
static
bool mitk::OpenCVVideoSource::OnlineImageUndistortionEnabled ( ) const
virtual
Returns
true if image undistorsion is enabled

Definition at line 226 of file mitkOpenCVVideoSource.cpp.

void mitk::OpenCVVideoSource::PauseCapturing ( )
overridevirtual

toggles m_CapturePaused In Subclasses this function can be overwritten to take measurs to provide a pause image, BUT DO NOT FORGET TO TOGGLE m_CapturePaused

Reimplemented from mitk::VideoSource.

Definition at line 231 of file mitkOpenCVVideoSource.cpp.

Referenced by QmitkOpenCVVideoControls::on_PlayButton_clicked(), QmitkOpenCVVideoControls::on_VideoProgressSlider_sliderPressed(), QmitkOpenCVVideoControls::on_VideoProgressSlider_sliderReleased(), and QmitkOpenCVVideoControls::Play().

void mitk::OpenCVVideoSource::Reset ( void  )
protected

Resets the whole class for capturing from a new device

Definition at line 390 of file mitkOpenCVVideoSource.cpp.

void mitk::OpenCVVideoSource::RGBtoHSV ( float  r,
float  g,
float  b,
float &  h,
float &  s,
float &  v 
)
protected

Definition at line 315 of file mitkOpenCVVideoSource.cpp.

void mitk::OpenCVVideoSource::SetEnableXAxisFlip ( bool  enable)
virtual

Definition at line 415 of file mitkOpenCVVideoSource.cpp.

void mitk::OpenCVVideoSource::SetEnableYAxisFlip ( bool  enable)
virtual

Definition at line 421 of file mitkOpenCVVideoSource.cpp.

virtual void mitk::OpenCVVideoSource::SetRepeatVideo ( bool  _arg)
virtual
void mitk::OpenCVVideoSource::SetVideoCameraInput ( int  cameraindex,
bool  useCVCAMLib = false 
)
virtual

Reimplemented in mitk::VideoInputSource.

Definition at line 54 of file mitkOpenCVVideoSource.cpp.

References MITK_ERROR.

Referenced by QmitkOpenCVVideoControls::Play().

int mitk::OpenCVVideoSource::SetVideoCaptureProperty ( int  property_id,
double  value 
)
virtual
void mitk::OpenCVVideoSource::SetVideoFileInput ( const char *  filename,
bool  repeatVideo,
bool  useCVCAMLib = false 
)
virtual

Reimplemented in mitk::VideoInputSource.

Definition at line 40 of file mitkOpenCVVideoSource.cpp.

References filename, and MITK_WARN.

Referenced by QmitkOpenCVVideoControls::Play().

void mitk::OpenCVVideoSource::sleep ( unsigned int  ms)
protected
void mitk::OpenCVVideoSource::StartCapturing ( )
overridevirtual

advices this class to start the video capturing. in this base implementation: toggles m_CapturingInProcess, resets m_FrameCount ATTENTION: this should be also done in subclasses overwriting this method

Reimplemented from mitk::VideoSource.

Reimplemented in mitk::VideoInputSource.

Definition at line 213 of file mitkOpenCVVideoSource.cpp.

Referenced by QmitkOpenCVVideoControls::Play().

void mitk::OpenCVVideoSource::StopCapturing ( )
overridevirtual

advices this class to stop the video capturing. in this base implementation: toggles m_CapturingInProcess, resets m_FrameCount ATTENTION: this should be also done in subclasses overwriting this method

Reimplemented from mitk::VideoSource.

Reimplemented in mitk::VideoInputSource.

Definition at line 221 of file mitkOpenCVVideoSource.cpp.

Referenced by QmitkOpenCVVideoControls::Stop().

void mitk::OpenCVVideoSource::UpdateVideoTexture ( )
protected

Definition at line 172 of file mitkOpenCVVideoSource.cpp.

Member Data Documentation

IplImage* mitk::OpenCVVideoSource::m_CurrentImage
protected

Definition at line 165 of file mitkOpenCVVideoSource.h.

Referenced by mitk::VideoInputSource::VideoInputSource().

unsigned char* mitk::OpenCVVideoSource::m_CurrentVideoTexture
protected

Definition at line 166 of file mitkOpenCVVideoSource.h.

bool mitk::OpenCVVideoSource::m_FlipXAxisEnabled
protected

Flag to enable or disable video flipping by X Axis.

Definition at line 191 of file mitkOpenCVVideoSource.h.

bool mitk::OpenCVVideoSource::m_FlipYAxisEnabled
protected

Flag to enable or disable video flipping by Y Axis.

Definition at line 196 of file mitkOpenCVVideoSource.h.

short mitk::OpenCVVideoSource::m_GrabbingDeviceNumber
protected

saves the grabbing device number (is -1 if a videofilename is used or if this is not initialized)

Definition at line 176 of file mitkOpenCVVideoSource.h.

IplImage* mitk::OpenCVVideoSource::m_PauseImage
protected

Definition at line 168 of file mitkOpenCVVideoSource.h.

bool mitk::OpenCVVideoSource::m_RepeatVideo
protected

Definition at line 179 of file mitkOpenCVVideoSource.h.

mitk::UndistortCameraImage::Pointer mitk::OpenCVVideoSource::m_UndistortCameraImage
protected

Definition at line 186 of file mitkOpenCVVideoSource.h.

bool mitk::OpenCVVideoSource::m_UndistortImage
protected

Definition at line 185 of file mitkOpenCVVideoSource.h.

Referenced by mitk::VideoInputSource::VideoInputSource().

bool mitk::OpenCVVideoSource::m_UseCVCAMLib
protected

Definition at line 182 of file mitkOpenCVVideoSource.h.

CvCapture* mitk::OpenCVVideoSource::m_VideoCapture
protected

Definition at line 162 of file mitkOpenCVVideoSource.h.

std::string mitk::OpenCVVideoSource::m_VideoFileName
protected

saves the video file name (is empty if a grabbing device is used or if this is not initialized)

Definition at line 172 of file mitkOpenCVVideoSource.h.


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