diff --git a/Modules/OpenCVVideoSupport/UI/QmitkOpenCVVideoControls.h b/Modules/OpenCVVideoSupport/UI/QmitkOpenCVVideoControls.h index a01353983b..d3c516e1bc 100644 --- a/Modules/OpenCVVideoSupport/UI/QmitkOpenCVVideoControls.h +++ b/Modules/OpenCVVideoSupport/UI/QmitkOpenCVVideoControls.h @@ -1,120 +1,120 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkOpenCVVideoControls_h #define QmitkOpenCVVideoControls_h #include #include #include #include "opencv2/core.hpp" class QmitkRenderWindow; class QmitkVideoBackground; namespace mitk { class VideoSource; class OpenCVVideoSource; } class QmitkOpenCVVideoControlsPrivate; /// /// \brief Offers widgets to play/pause/stop a video on a certain render window with /// the use of an !initialized! QmitkVideoBackground. The QmitkVideoBackground should /// contain an OpenCVVideoSource is then owned by this widget (and deleted) /// class MITKOPENCVVIDEOSUPPORTUI_EXPORT QmitkOpenCVVideoControls : public QWidget, public mitk::PropertyListReplacedObserver { Q_OBJECT public: /// /// Construct the widget with the given render window and the given preset values /// QmitkOpenCVVideoControls(QmitkVideoBackground* _VideoBackground, QmitkRenderWindow* _RenderWindow , QWidget* parent = nullptr, Qt::WindowFlags f = nullptr); /// /// call reset if video playback is enabled here /// ~QmitkOpenCVVideoControls() override; /// /// sets the render window for this video player /// void SetRenderWindow(QmitkRenderWindow* _RenderWindow); /// /// returns the current render window /// QmitkRenderWindow* GetRenderWindow() const; /// /// sets the qmitkvideobackground for this /// void SetVideoBackground(QmitkVideoBackground* _VideoBackground); /// /// returns the current QmitkVideoBackground /// QmitkVideoBackground* GetVideoBackground() const; /// /// calls FromPropertyList /// void AfterPropertyListReplaced(const std::string& id, mitk::PropertyList* propertyList) override; signals: /// /// When playback is started this informs when a new frame was grabbed /// - void NewOpenCVFrameAvailable(const IplImage*); + void NewOpenCVFrameAvailable(const cv::Mat*); protected slots: void on_UseGrabbingDeviceButton_clicked(bool checked = false); void on_UseVideoFileButton_clicked(bool checked = false); void on_VideoProgressSlider_sliderPressed(); void on_VideoProgressSlider_sliderReleased(); void on_VideoProgressSlider_valueChanged(int value); void on_RepeatVideoButton_clicked(bool checked = false); void on_PlayButton_clicked(bool checked = false); void on_StopButton_clicked(bool checked = false); void Play(); void Stop(); void Reset(); void IsPlaying(bool paused); void QObjectDestroyed(QObject * obj = nullptr); void NewFrameAvailable(mitk::VideoSource* videoSource); void EndOfVideoSourceReached(mitk::VideoSource* videoSource); protected: QmitkVideoBackground* m_VideoBackground; QmitkRenderWindow* m_RenderWindow; mitk::OpenCVVideoSource* m_VideoSource; Ui::QmitkOpenCVVideoControls* m_Controls; bool m_SliderCurrentlyMoved; private: friend class QmitkOpenCVVideoControlsPrivate; QScopedPointer d; }; #endif diff --git a/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp b/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp index 8543ee7d90..92a05433d3 100644 --- a/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp +++ b/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.cpp @@ -1,428 +1,432 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkOpenCVVideoSource.h" #include #include mitk::OpenCVVideoSource::OpenCVVideoSource() : m_VideoCapture(nullptr), m_CurrentImage(nullptr), m_CurrentVideoTexture(nullptr), m_PauseImage(nullptr), m_GrabbingDeviceNumber(-1), m_RepeatVideo(false), m_UseCVCAMLib(false), m_UndistortImage(false), m_FlipXAxisEnabled(false), m_FlipYAxisEnabled(false) +// m_currentFrame(nullptr) { } mitk::OpenCVVideoSource::~OpenCVVideoSource() { this->Reset(); } void mitk::OpenCVVideoSource::SetVideoFileInput(const char * filename, bool repeatVideo, bool /*useCVCAMLib*/) { this->Reset(); m_VideoFileName = filename; - m_VideoCapture = cvCaptureFromFile(filename); + m_VideoCapture = new cv::VideoCapture(); + m_VideoCapture->open(filename); if(!m_VideoCapture) MITK_WARN << "Error in initializing video file input!"; m_RepeatVideo = repeatVideo; //m_CurrentImage = cvCreateImage(cvSize(m_CaptureWidth,m_CaptureHeight),8,3); this->Modified(); } void mitk::OpenCVVideoSource::SetVideoCameraInput(int cameraindex, bool /*useCVCAMLib*/) { this->Reset(); m_GrabbingDeviceNumber = cameraindex; - m_VideoCapture = cvCaptureFromCAM(m_GrabbingDeviceNumber); + m_VideoCapture = new cv::VideoCapture(cameraindex); if(!m_VideoCapture) MITK_ERROR << "Error in initializing CVHighGUI video camera!"<< std::endl; this->Modified(); } double mitk::OpenCVVideoSource::GetVideoCaptureProperty(int property_id) { - return cvGetCaptureProperty(m_VideoCapture, property_id); + return m_VideoCapture->get(property_id); } int mitk::OpenCVVideoSource::SetVideoCaptureProperty(int property_id, double value) { - return cvSetCaptureProperty(m_VideoCapture, property_id, value); + return m_VideoCapture->set(property_id, value); } //method extended for "static video feature" if enabled unsigned char* mitk::OpenCVVideoSource::GetVideoTexture() { // Fetch Frame and return pointer to opengl texture FetchFrame(); if (m_FlipXAxisEnabled || m_FlipYAxisEnabled) { //rotate the image to get a static video m_CurrentImage = this->FlipImage(m_CurrentImage); } //transfer the image to a texture this->UpdateVideoTexture(); return this->m_CurrentVideoTexture; this->Modified(); } cv::Mat mitk::OpenCVVideoSource::GetImage() { if(m_CurrentImage) { cv::Mat copy = cv::cvarrToMat( m_CurrentImage, false ); return copy.clone(); } return cv::Mat(); } -const IplImage * mitk::OpenCVVideoSource::GetCurrentFrame() +const cv::Mat * mitk::OpenCVVideoSource::GetCurrentFrame() { - return m_CurrentImage; + return &m_currentFrame; } -void mitk::OpenCVVideoSource::GetCurrentFrameAsOpenCVImage(IplImage * image) +/* +void mitk::OpenCVVideoSource::GetCurrentFrameAsOpenCVImage(cv::Mat * image) { // get last captured frame for processing the image data if(m_CurrentImage) { if(image) { image->origin = m_CurrentImage->origin; memcpy(image->imageData,m_CurrentImage->imageData,m_CurrentImage->width*m_CurrentImage->height*m_CurrentImage->nChannels); } } } +*/ void mitk::OpenCVVideoSource::FetchFrame() { // main procedure for updating video data if(m_CapturingInProcess) { - if(m_VideoCapture) // we use highgui + if(m_VideoCapture->isOpened()) // we use highgui { if(!m_CapturePaused) { // release old image here - m_CurrentImage = cvQueryFrame(m_VideoCapture); + m_VideoCapture->read(m_currentFrame); ++m_FrameCount; } - if(m_CurrentImage == nullptr) // do we need to repeat the video if it is from video file? + if(m_currentFrame.empty()) // do we need to repeat the video if it is from video file? { double framePos = this->GetVideoCaptureProperty(CV_CAP_PROP_POS_AVI_RATIO); MITK_DEBUG << "End of video file found. framePos: " << framePos; if(m_RepeatVideo && framePos >= 0.99) { MITK_DEBUG << "Restarting video file playback."; this->SetVideoCaptureProperty(CV_CAP_PROP_POS_AVI_RATIO, 0); m_FrameCount = 0; - m_CurrentImage = cvQueryFrame(m_VideoCapture); + //m_CurrentImage = cvQueryFrame(m_VideoCapture); } else { std::ostringstream s; s << "End of video file " << m_VideoFileName; std::logic_error err( s.str() ); throw err; } } else { // only undistort if not paused - if(m_UndistortImage && m_UndistortCameraImage.IsNotNull()) - m_UndistortCameraImage->UndistortImageFast(m_CurrentImage, nullptr); + //if(m_UndistortImage && m_UndistortCameraImage.IsNotNull()) + // m_UndistortCameraImage->UndistortImageFast(m_CurrentImage, nullptr); } if(m_CaptureWidth == 0 || m_CaptureHeight == 0) { MITK_DEBUG << "Trying to set m_CaptureWidth & m_CaptureHeight."; - m_CaptureWidth = m_CurrentImage->width; - m_CaptureHeight = m_CurrentImage->height; + m_CaptureWidth = m_currentFrame.cols; + m_CaptureHeight = m_currentFrame.rows; MITK_INFO << "frame width: " << m_CaptureWidth << ", height: " << m_CaptureHeight; - m_CurrentImage->origin = 0; + //m_CurrentImage->origin = 0; } } } } void mitk::OpenCVVideoSource::UpdateVideoTexture() { //write the grabbed frame into an opengl compatible array, that means flip it and swap channel order - if(!m_CurrentImage) + if(m_currentFrame.empty()) return; if(m_CurrentVideoTexture == nullptr) m_CurrentVideoTexture = new unsigned char[m_CaptureWidth*m_CaptureHeight*3]; - int width = m_CurrentImage->width; - int height = m_CurrentImage->height; - int widthStep = m_CurrentImage->widthStep; - int nChannels = m_CurrentImage->nChannels; + int width = m_currentFrame.cols; + int height = m_currentFrame.rows; + int widthStep = m_currentFrame.step; + int nChannels = m_currentFrame.channels(); unsigned char* tex = m_CurrentVideoTexture; - char* data = m_CurrentImage->imageData; - char* currentData = m_CurrentImage->imageData; + uchar *data = m_currentFrame.data; + uchar *currentData = m_currentFrame.data; int hIndex=0; int wIndex=0; int iout,jout; for(int i=0;i= width) { wIndex=0; hIndex++; } // vertically flip the image iout = -hIndex+height-1; jout = wIndex; currentData = data + iout*widthStep; tex[i+2] = currentData[jout*nChannels + 0]; // B tex[i+1] = currentData[jout*nChannels + 1]; // G tex[i] = currentData[jout*nChannels + 2]; // R } } void mitk::OpenCVVideoSource::StartCapturing() { if(m_VideoCapture != nullptr) m_CapturingInProcess = true; else m_CapturingInProcess = false; } void mitk::OpenCVVideoSource::StopCapturing() { m_CapturePaused = false; m_CapturingInProcess = false; } bool mitk::OpenCVVideoSource::OnlineImageUndistortionEnabled() const { return m_UndistortCameraImage; } void mitk::OpenCVVideoSource::PauseCapturing() { m_CapturePaused = !m_CapturePaused; if(m_CapturePaused) { - m_PauseImage = cvCloneImage(m_CurrentImage); + // m_PauseImage = cvCloneImage(m_CurrentImage); // undistort this pause image if necessary - if(m_UndistortImage) - m_UndistortCameraImage->UndistortImageFast(m_PauseImage, nullptr); - m_CurrentImage = m_PauseImage; + //if(m_UndistortImage) + // m_UndistortCameraImage->UndistortImageFast(m_PauseImage, nullptr); + //m_CurrentImage = m_PauseImage; } else { - cvReleaseImage( &m_PauseImage ); // release old pause image if necessary + //cvReleaseImage( &m_PauseImage ); // release old pause image if necessary m_CurrentImage = nullptr; m_PauseImage = nullptr; } } void mitk::OpenCVVideoSource::EnableOnlineImageUndistortion(mitk::Point3D focal, mitk::Point3D principal, mitk::Point4D distortion) { // Initialize Undistortion m_UndistortImage = true; float kc[4]; kc[0] = distortion[0]; kc[1] = distortion[1]; kc[2] = distortion[2]; kc[3] = distortion[3]; if(m_CaptureWidth == 0 || m_CaptureHeight == 0) FetchFrame(); m_UndistortCameraImage = mitk::UndistortCameraImage::New(); m_UndistortCameraImage->SetUndistortImageFastInfo(focal[0], focal[1], principal[0], principal[1], kc, (float)m_CaptureWidth, (float)m_CaptureHeight); } void mitk::OpenCVVideoSource::DisableOnlineImageUndistortion() { m_UndistortImage = false; } // functions for compatibility with ITK segmentation only void mitk::OpenCVVideoSource::GetCurrentFrameAsItkHSVPixelImage(HSVPixelImageType::Pointer &Image) { FetchFrame(); // Prepare iteration HSVConstIteratorType itImage( Image, Image->GetLargestPossibleRegion()); itImage.GoToBegin(); HSVPixelType pixel; int rowsize = 3 * m_CaptureWidth; - char* bufferend; - char* picture; - picture = this->m_CurrentImage->imageData; - bufferend = this->m_CurrentImage->imageData + 3*(m_CaptureHeight*m_CaptureWidth); + uchar* bufferend; + uchar* picture; + picture = this->m_CurrentImage->data; + bufferend = this->m_CurrentImage->data + 3*(m_CaptureHeight*m_CaptureWidth); float r,g,b,h,s,v; try { // we have to flip the image - for(char* datapointer = bufferend - rowsize;datapointer >= picture; datapointer -= rowsize) + for(uchar* datapointer = bufferend - rowsize;datapointer >= picture; datapointer -= rowsize) { - for(char* current = datapointer; current < datapointer + rowsize; current++) + for(uchar* current = datapointer; current < datapointer + rowsize; current++) { b = *current; current++; g = *current; current++; r = *current; RGBtoHSV(r,g,b,h,s,v); pixel[0] = h; pixel[1] = s; pixel[2] = v; itImage.Set(pixel); ++itImage; } } } catch( ... ) { std::cout << "Exception raised mitkOpenCVVideoSource: get hsv itk image conversion error." << std::endl; } } void mitk::OpenCVVideoSource::RGBtoHSV(float r, float g, float b, float &h, float &s, float &v) { if(r > 1.0) r = r/255; if(b > 1.0) b = b/255; if(g > 1.0) g = g/255; float mn=r,mx=r; int maxVal=0; if (g > mx){ mx=g;maxVal=1;} if (b > mx){ mx=b;maxVal=2;} if (g < mn) mn=g; if (b < mn) mn=b; float delta = mx - mn; v = mx; if( mx != 0 ) s = delta / mx; else { s = 0; h = 0; return; } if (s==0.0f) { h=-1; return; } else { switch (maxVal) { case 0:{h = ( g - b ) / delta;break;} // yel < h < mag case 1:{h = 2 + ( b - r ) / delta;break;} // cyan < h < yel case 2:{h = 4 + ( r - g ) / delta;break;} // mag < h < cyan } } h *= 60; if( h < 0 ) h += 360; } /* * Rotate input image according to rotation angle around the viewing direction. * Angle is supposed to be calculated in QmitkARRotationComponet in the update() method. */ -IplImage* mitk::OpenCVVideoSource::FlipImage(IplImage* input) +cv::Mat* mitk::OpenCVVideoSource::FlipImage(cv::Mat* input) { if(input == nullptr) { //warn the user and quit std::cout<<"openCVVideoSource: Current video image is null! "<< std::endl; return input; } if(m_FlipXAxisEnabled && !m_FlipYAxisEnabled) { cvFlip(input,nullptr,0); } if(!m_FlipXAxisEnabled && m_FlipYAxisEnabled) { cvFlip(input,nullptr,1); } if(m_FlipXAxisEnabled && m_FlipYAxisEnabled) { cvFlip(input,nullptr,-1); } return input; } void mitk::OpenCVVideoSource::Reset() { // set capturing to false this->StopCapturing(); this->m_FrameCount = 0; - if(m_VideoCapture) - cvReleaseCapture(&m_VideoCapture); + if (m_VideoCapture) + m_VideoCapture->release(); m_VideoCapture = nullptr; m_CurrentImage = nullptr; m_CaptureWidth = 0; m_CaptureHeight = 0; delete m_CurrentVideoTexture; m_CurrentVideoTexture = nullptr; - if(m_PauseImage) - cvReleaseImage(&m_PauseImage); + // if(m_PauseImage) + //cvReleaseImage(&m_PauseImage); m_PauseImage = nullptr; m_CapturePaused = false; m_VideoFileName.clear(); m_GrabbingDeviceNumber = -1; // do not touch repeat video //m_RepeatVideo = false; m_UseCVCAMLib = false; // do not touch undistort settings // bool m_UndistortImage; } void mitk::OpenCVVideoSource::SetEnableXAxisFlip(bool enable) { this->m_FlipXAxisEnabled = enable; this->Modified(); } void mitk::OpenCVVideoSource::SetEnableYAxisFlip(bool enable) { this->m_FlipXAxisEnabled = enable; this->Modified(); } diff --git a/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.h b/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.h index 7aa1e6c18d..c4680ed4cf 100644 --- a/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.h +++ b/Modules/OpenCVVideoSupport/mitkOpenCVVideoSource.h @@ -1,201 +1,202 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _mitk_OpenCVVideo_Source_h_ #define _mitk_OpenCVVideo_Source_h_ #include "mitkConfig.h" #include "mitkVideoSource.h" #include "mitkUndistortCameraImage.h" // HighGui camera interface: a convenient way for grabbing from a video capture (on windows VfW is used) #include // For Providing ITK Image Interface #include "itkRGBPixel.h" #include "itkImage.h" #include "itkImageRegionIterator.h" #include "mitkOpenCVImageSource.h" namespace mitk { /** * 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(); */ class MITKOPENCVVIDEOSUPPORT_EXPORT OpenCVVideoSource : virtual public VideoSource, virtual public OpenCVImageSource { public: typedef itk::RGBPixel< unsigned char > CharPixelType; typedef itk::FixedArray HSVPixelType; typedef itk::Image< CharPixelType , 2 > RGBPixelImageType; typedef itk::Image HSVPixelImageType; typedef itk::ImageRegionIterator< RGBPixelImageType > RGBConstIteratorType; typedef itk::ImageRegionIterator< HSVPixelImageType > HSVConstIteratorType; mitkClassMacro( OpenCVVideoSource, VideoSource ); itkFactorylessNewMacro(Self) itkCloneMacro(Self) ////##Documentation ////## @brief sets a video file as input device. One video frame is being processed by updating the renderwindow. ////## Notice: Which codecs and file formats are supported depends on the back end library. ////## Common Function that currently uses HighGui Lib for video playback virtual void SetVideoFileInput(const char * filename, bool repeatVideo, bool useCVCAMLib = false); ////##Documentation ////##@brief Initializes capturing video from camera. ////## Common Function for use either with HIGHGUI or with CVCAM library ////## On windows: if you use CVCAM Library, you can pass -1 as camera index for a selection menu virtual void SetVideoCameraInput(int cameraindex, bool useCVCAMLib = false); ////##Documentation ////## The function GetVideoCaptureProperty retrieves the specified property of camera or video file from HIGHGUI LIBRARY. ////## Video input has to be initialized before call, that means: at least one frame has to be grabbed already. ////## The property_id identifier can be the following: ////## CV_CAP_PROP_POS_MSEC film current position in milliseconds or video capture timestamp ////## CV_CAP_PROP_POS_FRAMES 0-based index of the frame to be decoded/captured next ////## CV_CAP_PROP_POS_AVI_RATIO relative position of video file (0 - start of the film, 1 - end of the film) ////## CV_CAP_PROP_FRAME_WIDTH width of frames in the video stream ////## CV_CAP_PROP_FRAME_HEIGHT height of frames in the video stream ////## CV_CAP_PROP_FPS frame rate ////## CV_CAP_PROP_FOURCC 4-character code of codec ////## CV_CAP_PROP_FRAME_COUNT number of frames in video file ////## See OpenCV Highgui documentation for more details ( http://opencvlibrary.sourceforge.net/HighGui ) virtual double GetVideoCaptureProperty(int property_id); ////##Documentation ////## @brief sets the specified property of video capturing from HIGHGUI LIBRARY. ////## Notice: Some properties only can be set using a video file as input devices, others using a camera. ////## See OpenCV Highgui documentation for more details ( http://opencvlibrary.sourceforge.net/HighGui ) virtual int SetVideoCaptureProperty(int property_id, double value); - virtual void GetCurrentFrameAsOpenCVImage(IplImage * image); + //virtual void GetCurrentFrameAsOpenCVImage(cv::Mat * image); /// /// \return a copy of the image as opencv 2 Mat /// cv::Mat GetImage() override; - virtual const IplImage * GetCurrentFrame(); + virtual const cv::Mat * GetCurrentFrame(); ////##Documentation ////## @brief returns the current video data as an ITK image. virtual void GetCurrentFrameAsItkHSVPixelImage(HSVPixelImageType::Pointer &Image); ////##Documentation ////## @brief assigns the grabbing devices for acquiring the next frame. void FetchFrame() override; ////##Documentation ////## @brief returns a pointer to the image data array for opengl rendering. unsigned char * GetVideoTexture() override; ////##Documentation ////## @brief starts the video capturing. void StartCapturing() override; ////##Documentation ////## @brief stops the video capturing. void StopCapturing() override; ////##Documentation ////## @brief rotate image according to the set angle. - virtual IplImage* FlipImage(IplImage* input); + virtual cv::Mat* FlipImage(cv::Mat* input); ////##Documentation ////## @brief EnableOnlineImageUndistortion allows for an online image undistortion directly after capturing an image. ////## The function has to be called after setting up the video input; the result is made accessible via the normal ////## GetCurrentFrame... functions. virtual void EnableOnlineImageUndistortion(mitk::Point3D focal, mitk::Point3D principal, mitk::Point4D distortion); ////##Documentation ////## @brief DisableOnlineImageUndistortion is used to disable the automatic image undistortion. virtual void DisableOnlineImageUndistortion(); /// /// \return true if image undistorsion is enabled /// virtual bool OnlineImageUndistortionEnabled() const; void PauseCapturing() override; /// /// Returns the video file name (maybe empty if a grabbing device is used) /// itkGetConstMacro( VideoFileName, std::string ); virtual void SetEnableXAxisFlip(bool enable); virtual void SetEnableYAxisFlip(bool enable); /// /// Returns the GrabbingDeviceNumber (maybe -1 if a video file is used) /// itkGetConstMacro( GrabbingDeviceNumber, short ); itkGetMacro( RepeatVideo, bool ); itkSetMacro( RepeatVideo, bool ); protected: OpenCVVideoSource(); ~OpenCVVideoSource() override; /// /// Resets the whole class for capturing from a new device /// void Reset(); ////##Documentation ////## @brief internally used for converting the current video frame to a texture for opengl rendering, ////## so that GetVideoTexture() can be used. void UpdateVideoTexture(); // Helper functions void sleep(unsigned int ms); void RGBtoHSV(float r, float g, float b, float &h, float &s, float &v); // HighGUI Library capture device - CvCapture * m_VideoCapture; + cv::VideoCapture * m_VideoCapture; // current Video image - IplImage * m_CurrentImage; + cv::Mat * m_CurrentImage; + cv::Mat m_currentFrame; unsigned char* m_CurrentVideoTexture; - IplImage * m_PauseImage; + cv::Mat * m_PauseImage; /// /// saves the video file name (is empty if a grabbing device is used or if this is not initialized) std::string m_VideoFileName; /// /// saves the grabbing device number (is -1 if a videofilename is used or if this is not initialized) short m_GrabbingDeviceNumber; // Repeat a video file bool m_RepeatVideo; // Switch between CVCAM Lib and HighGui Lib bool m_UseCVCAMLib; // On-the-fly undistortion of the captured video image bool m_UndistortImage; mitk::UndistortCameraImage::Pointer m_UndistortCameraImage; /** * Flag to enable or disable video flipping by X Axis. **/ bool m_FlipXAxisEnabled; /** * Flag to enable or disable video flipping by Y Axis. **/ bool m_FlipYAxisEnabled; }; } #endif // Header