Skip to content

Instantly share code, notes, and snippets.

@jigpu
Created November 21, 2019 23:29
Show Gist options
  • Save jigpu/c94fd055d97655f22a3d94f59f9f2610 to your computer and use it in GitHub Desktop.
Save jigpu/c94fd055d97655f22a3d94f59f9f2610 to your computer and use it in GitHub Desktop.
Updated sdrangel-opencv4.patch for sdrangel 3b74153ec635 and newer
--- a/plugins/channeltx/modatv/atvmodsource.cpp 2019-11-21 15:15:21.481489827 -0800
+++ b/plugins/channeltx/modatv/atvmodsource.cpp 2019-11-21 15:21:01.449347861 -0800
@@ -321,7 +321,7 @@
mixImageAndText(colorFrame);
}
- cv::cvtColor(colorFrame, m_videoframeOriginal, CV_BGR2GRAY);
+ cv::cvtColor(colorFrame, m_videoframeOriginal, cv::COLOR_BGR2GRAY);
resizeVideo();
}
}
@@ -448,7 +448,7 @@
mixImageAndText(colorFrame);
}
- cv::cvtColor(colorFrame, camera.m_videoframeOriginal, CV_BGR2GRAY);
+ cv::cvtColor(colorFrame, camera.m_videoframeOriginal, cv::COLOR_BGR2GRAY);
resizeCamera();
}
@@ -653,7 +653,7 @@
void ATVModSource::openImage(const QString& fileName)
{
- m_imageFromFile = cv::imread(qPrintable(fileName), CV_LOAD_IMAGE_GRAYSCALE);
+ m_imageFromFile = cv::imread(qPrintable(fileName), cv::IMREAD_GRAYSCALE);
m_imageOK = m_imageFromFile.data != 0;
if (m_imageOK)
@@ -683,11 +683,11 @@
if (m_videoOK)
{
m_settings.m_videoFileName = fileName;
- m_videoFPS = m_video.get(CV_CAP_PROP_FPS);
- m_videoWidth = (int) m_video.get(CV_CAP_PROP_FRAME_WIDTH);
- m_videoHeight = (int) m_video.get(CV_CAP_PROP_FRAME_HEIGHT);
- m_videoLength = (int) m_video.get(CV_CAP_PROP_FRAME_COUNT);
- int ex = static_cast<int>(m_video.get(CV_CAP_PROP_FOURCC));
+ m_videoFPS = m_video.get(cv::CAP_PROP_FPS);
+ m_videoWidth = (int) m_video.get(cv::CAP_PROP_FRAME_WIDTH);
+ m_videoHeight = (int) m_video.get(cv::CAP_PROP_FRAME_HEIGHT);
+ m_videoLength = (int) m_video.get(cv::CAP_PROP_FRAME_COUNT);
+ int ex = static_cast<int>(m_video.get(cv::CAP_PROP_FOURCC));
char ext[] = {(char)(ex & 0XFF),(char)((ex & 0XFF00) >> 8),(char)((ex & 0XFF0000) >> 16),(char)((ex & 0XFF000000) >> 24),0};
qDebug("ATVModSource::openVideo: %s FPS: %f size: %d x %d #frames: %d codec: %s",
@@ -781,7 +781,7 @@
if ((m_videoOK) && m_video.isOpened())
{
int seekPoint = ((m_videoLength * seekPercentage) / 100);
- m_video.set(CV_CAP_PROP_POS_FRAMES, seekPoint);
+ m_video.set(cv::CAP_PROP_POS_FRAMES, seekPoint);
m_videoFPSCount = m_videoFPSq;
m_videoPrevFPSCount = 0;
m_videoEOF = false;
@@ -799,9 +799,9 @@
if (m_cameras.back().m_camera.isOpened())
{
- m_cameras.back().m_videoFPS = m_cameras.back().m_camera.get(CV_CAP_PROP_FPS);
- m_cameras.back().m_videoWidth = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_WIDTH);
- m_cameras.back().m_videoHeight = (int) m_cameras.back().m_camera.get(CV_CAP_PROP_FRAME_HEIGHT);
+ m_cameras.back().m_videoFPS = m_cameras.back().m_camera.get(cv::CAP_PROP_FPS);
+ m_cameras.back().m_videoWidth = (int) m_cameras.back().m_camera.get(cv::CAP_PROP_FRAME_WIDTH);
+ m_cameras.back().m_videoHeight = (int) m_cameras.back().m_camera.get(cv::CAP_PROP_FRAME_HEIGHT);
//m_cameras.back().m_videoFPS = m_cameras.back().m_videoFPS < 0 ? 16.3f : m_cameras.back().m_videoFPS;
@@ -872,7 +872,7 @@
// position the text in the top left corner
cv::Point textOrg(6, textSize.height+10);
// then put the text itself
- cv::putText(image, m_settings.m_overlayText.toStdString(), textOrg, fontFace, fontScale, cv::Scalar::all(255*m_settings.m_uniformLevel), thickness, CV_AA);
+ cv::putText(image, m_settings.m_overlayText.toStdString(), textOrg, fontFace, fontScale, cv::Scalar::all(255*m_settings.m_uniformLevel), thickness, cv::LINE_AA);
}
void ATVModSource::applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force)
@@ -1028,7 +1028,7 @@
if (m_videoOK && m_video.isOpened())
{
- framesCount = m_video.get(CV_CAP_PROP_POS_FRAMES);;
+ framesCount = m_video.get(cv::CAP_PROP_POS_FRAMES);;
} else {
framesCount = 0;
}
@@ -1070,4 +1070,4 @@
m_cameras[index].m_videoFPSManual = mnaualFPS;
m_cameras[index].m_videoFPSManualEnable = manualFPSEnable;
}
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment