diff --git a/README.md b/README.md index 026c9ef..1e97c94 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ constant. ## Installation -VidMan requires [Qt 4.8 or higher](https://www.qt.io/) and [OpenCV 3.0 or higher](https://opencv.org) +VidMan requires [Qt 5.0 or higher](https://www.qt.io/) and [OpenCV 4.0 or higher](https://opencv.org) to compile. Other packages required are `libjpeg-dev` and -`libdc1394-22-dev`, which can be installed via: +`libdc1394-22-dev`. On Ubuntu, requirements can be installed with: ``` -sudo apt-get install libjpeg-dev libdc1394-22-dev +sudo apt install qtbase5-dev libopencv-dev libjpeg-dev libdc1394-dev ``` To compile you can either open the project in Qt creator and proceed from there diff --git a/app/app.pro b/app/app.pro index 9e2ad3a..cc6e3ec 100644 --- a/app/app.pro +++ b/app/app.pro @@ -44,7 +44,7 @@ CONFIG(release, debug|release) { QMAKE_CXXFLAGS_RELEASE += -O3 } -PKGCONFIG += opencv +PKGCONFIG += opencv4 LIBS += -L../lib -lvidman_$$BUILD -ldc1394 -ljpeg TARGET = vidman_$$BUILD diff --git a/src/camera.cpp b/src/camera.cpp index b44a2fa..b1baaa0 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -30,7 +30,7 @@ Camera::Camera() : empty_(true) { // Initialize the camera - capCam_.open(CV_CAP_FIREWIRE); + capCam_.open(cv::CAP_FIREWIRE); if(!capCam_.isOpened()) { cerr << "No cameras found" << endl; return; @@ -63,7 +63,7 @@ Camera::Camera() : } cout << "Using camera with GUID " << dc1394Camera_->guid << endl; - capCam_.set(CV_CAP_PROP_BUFFERSIZE, RingBufSz); + capCam_.set(cv::CAP_PROP_BUFFERSIZE, RingBufSz); empty_ = false; } @@ -79,7 +79,7 @@ Camera::~Camera() void Camera::setFPS(int fps) { - if(!capCam_.set(CV_CAP_PROP_FPS, fps)) + if(!capCam_.set(cv::CAP_PROP_FPS, fps)) cerr << "Couldn't set framerate" << endl; } diff --git a/src/cameraworker.cpp b/src/cameraworker.cpp index affcf09..a0e669b 100644 --- a/src/cameraworker.cpp +++ b/src/cameraworker.cpp @@ -55,7 +55,7 @@ CameraWorker::CameraWorker(CycDataBuffer* cycBuf, Camera &cam): QImage fixImg(":/img/fixPoint.png"); cv::Mat fixMat = cv::Mat(fixImg.height(), fixImg.width(), CV_8UC4, fixImg.bits(), fixImg.bytesPerLine()).clone(); - cv::cvtColor(fixMat, fixMat, CV_RGBA2BGRA); + cv::cvtColor(fixMat, fixMat, cv::COLOR_RGBA2BGRA); if(!fixMat.empty()) { cv::Point2i pos((VIDEO_WIDTH-fixMat.cols)/2, @@ -101,7 +101,7 @@ void CameraWorker::captureFrame() // Process signals emitted by events_->applyEvents(). QCoreApplication::processEvents(); - cv::cvtColor(frame_, frame_, CV_BGR2RGB); + cv::cvtColor(frame_, frame_, cv::COLOR_BGR2RGB); ChunkAttrib chunkAttrib; strncpy(chunkAttrib.log, log_.toStdString().c_str(), MAXLOG); diff --git a/src/event.cpp b/src/event.cpp index aecfb13..00e05da 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -494,8 +494,8 @@ int MotionDetectorEvent::nChanges() cv::absdiff(prev_, next_, d1); cv::absdiff(current_, next_, d2); cv::bitwise_and(d1, d2, result_); - cv::cvtColor(result_, result_, CV_BGR2GRAY); - cv::threshold(result_, result_, 5, White, CV_THRESH_BINARY); + cv::cvtColor(result_, result_, cv::COLOR_BGR2GRAY); + cv::threshold(result_, result_, 5, White, cv::THRESH_BINARY); cv::erode(result_,result_,cv::Mat()); cv::dilate(result_,result_,cv::Mat()); diff --git a/src/eventparser.cpp b/src/eventparser.cpp index f952711..49ac1cc 100644 --- a/src/eventparser.cpp +++ b/src/eventparser.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "mainwindow.h" #include "eventparser.h" @@ -149,7 +149,7 @@ bool EventParser::parseObject(const QString &str) if(attr.objectType_ == "image") { cv::Mat file(cv::imread(attr.fileName_.toStdString(), - CV_LOAD_IMAGE_UNCHANGED)); + cv::IMREAD_UNCHANGED)); if(file.empty()) { emit error(QString("Error: couldn't load image file '%1'.") .arg(attr.fileName_)); diff --git a/src/glworker.cpp b/src/glworker.cpp index 5f3bd2c..3e60b78 100644 --- a/src/glworker.cpp +++ b/src/glworker.cpp @@ -18,6 +18,7 @@ */ #include +#include #include #include diff --git a/src/src.pro b/src/src.pro index 850498e..58e30ce 100644 --- a/src/src.pro +++ b/src/src.pro @@ -75,7 +75,7 @@ FORMS += mainwindow.ui \ videodialog.ui \ motiondialog.ui -PKGCONFIG += opencv +PKGCONFIG += opencv4 LIBS += -ldc1394 -ljpeg QMAKE_CXXFLAGS += -std=c++11 diff --git a/tests/tests.pro b/tests/tests.pro index 4655949..1f99f5c 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -28,7 +28,7 @@ else { CONFIG+=qtestlib } -PKGCONFIG += opencv +PKGCONFIG += opencv4 LIBS += -L../lib -lvidman_debug -ldc1394 -ljpeg QMAKE_CXXFLAGS += -std=c++11