Enable OpenCV4 compability

This commit is contained in:
JFilipe committed 2019-02-25 18:09:43 +00:00
1 parent b20d5aef49
commit 2eec03b23f
5 files changed
+22 -3

No files matched your search

+8
View File
@@ -29,6 +29,9 @@
#include <cstdio>
#include <opencv2/opencv.hpp>
#if CV_MAJOR_VERSION >= 4
#include <opencv2/videoio.hpp>
#endif
using cv::Mat;
using cv::VideoCapture;
@@ -78,8 +81,13 @@ bool StreamHandlerOpenCV::openHandler( ClpString strFilename, bool bInput )
m_strFormatName = "DEV";
m_strCodecName = "Raw Video";
pcVideoCapture = new VideoCapture( iDeviceId );
#if CV_MAJOR_VERSION >= 4
m_uiWidth = pcVideoCapture->get( cv::CAP_PROP_FRAME_WIDTH );
m_uiHeight = pcVideoCapture->get( cv::CAP_PROP_FRAME_HEIGHT );
#else
m_uiWidth = pcVideoCapture->get( CV_CAP_PROP_FRAME_WIDTH );
m_uiHeight = pcVideoCapture->get( CV_CAP_PROP_FRAME_HEIGHT );
#endif
m_dFrameRate = 25;
}
else