Commit 783e9469 authored by Thiago Santini's avatar Thiago Santini

Updating to OpenCV 4.1.0 (for Windows)

Compilation for Linux should be temporally broken
parent 95d6f8ef
......@@ -17,7 +17,7 @@
#include <QLabel>
#include <QRegularExpression>
#include "opencv/cv.h"
#include <opencv2/opencv.hpp>
#include "FrameGrabber.h"
......
......@@ -144,7 +144,7 @@ void CameraCalibration::processSample(const Mat& frame)
Mat gray = frame;
if (frame.channels() == 3)
cvtColor(frame, gray, CV_BGR2GRAY);
cvtColor(frame, gray, cv::COLOR_BGR2GRAY);
imageSize = { gray.cols, gray.rows };
......@@ -186,14 +186,14 @@ void CameraCalibration::processSample(const Mat& frame)
if (dbgCB->isChecked()) {
Mat tmp;
if (frame.channels() == 1)
cvtColor(frame, tmp, CV_GRAY2BGR);
cvtColor(frame, tmp, cv::COLOR_GRAY2BGR);
else
tmp = frame.clone();
if (found)
drawChessboardCorners(tmp, patternSize, Mat(pointBuf), found);
else
putText(tmp, "Pattern not found", Point(0, 0.5 * frame.rows), CV_FONT_HERSHEY_PLAIN, 2, Scalar(0, 0, 255));
putText(tmp, "Pattern not found", Point(0, 0.5 * frame.rows), cv::FONT_HERSHEY_PLAIN, 2, Scalar(0, 0, 255));
rectangle(tmp, covered, Scalar(0, 255, 0), 2);
imshow(DBG_WINDOW_NAME, tmp);
}
......
......@@ -148,9 +148,9 @@ public:
}
if (fishEye)
remap(in, out, map1, map2, CV_INTER_AREA);
remap(in, out, map1, map2, cv::INTER_AREA);
else
remap(in, out, map1, map2, CV_INTER_AREA);
remap(in, out, map1, map2, cv::INTER_AREA);
}
cv::Mat getCameraMatrix(const cv::Size& size) const
{
......
......@@ -438,11 +438,11 @@ QImage CameraWidget::previewImage(const cv::Mat& frame)
switch (frame.channels()) {
case 1:
cvtColor(frame, rgb, CV_GRAY2RGB);
cvtColor(frame, rgb, cv::COLOR_GRAY2BGR);
cv::resize(rgb, resized, previewSize, cv::INTER_NEAREST);
break;
case 3:
cvtColor(frame, rgb, CV_BGR2RGB);
cvtColor(frame, rgb, cv::COLOR_BGR2RGB);
cv::resize(rgb, resized, previewSize, cv::INTER_NEAREST);
break;
default:
......
......@@ -100,35 +100,20 @@ bool DataRecorder::splitVideoFile()
template <class T>
void DataRecorder::storeData(T& data)
{
if (!recording)
return;
if (firstFrame && videoWriter) {
firstFrame = false;
// TODO: Make the container and codecs parametrizable
// Alternative containers are .mkv and .mov, for which ffmpeg seems to use
// fourcc codes
/* OpenCV seems capable of using other containers now :D
*
* ffmpeg seems to use its own codes for tags instead of regular fourcc codes
* when mp4 container is selected; for most fourcc codes end up being invalid
* and it falls back to a default tag.
*
* From the ffmpeg source (libavformat/isom.c)
*
* { AV_CODEC_ID_MPEG4 , 0x20 },
* { AV_CODEC_ID_H264 , 0x21 },
* { AV_CODEC_ID_MJPEG , 0x6C }, // 10918-1
*
*
* MPEG4 and H264 are compressed.
* MJPEG is uncompressed (and therefore gives huge files!)
*
*/
// todo: migrate to ffmpeg or libav
QString fileName = id + ".mp4";
int codec = 0x6C;
auto fourcc = [](const char str[4]) { return VideoWriter::fourcc(str[0], str[1], str[2], str[3]); };
int codec = fourcc("jpeg"); // Uncompressed; Motion JPEG Video
//int codec = fourcc("xvid"); // Compressed; MPEG-4 Video
//int codec = fourcc("divx"); // Compressed; MPEG-4 Video
if (videoWriter->isOpened())
videoWriter->release();
......
......@@ -8,7 +8,7 @@
#include <QFileInfo>
#include <QObject>
#include <opencv/cv.hpp>
#include <opencv2/opencv.hpp>
#include "Synchronizer.h"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment