Skip to content

Commit

Permalink
Update mostly opencv names
Browse files Browse the repository at this point in the history
  • Loading branch information
rantahar committed Jan 23, 2024
1 parent cc04344 commit f666508
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 13 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ 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:

Expand All @@ -43,6 +43,12 @@ qmake CONFIG+=release
make
```

Additional steps I needed:
- Replace opencv with opencv4 in src.pro
- Install qtbase5-dev (really part of the first step), but not obvious
- Install libqt5opengl5-dev, libhighgui-dev


## Usage

VidMan works by applying specific events to each frame captured by the video
Expand Down
2 changes: 1 addition & 1 deletion app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/cameraworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
4 changes: 2 additions & 2 deletions src/eventparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <iostream>
#include <QStringList>
#include <sys/ioctl.h>
#include <opencv/highgui.h>
#include <opencv2/highgui.hpp>

#include "mainwindow.h"
#include "eventparser.h"
Expand Down Expand Up @@ -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_));
Expand Down
1 change: 1 addition & 0 deletions src/glworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <iostream>
#include <math.h>
#include <QCoreApplication>
#include <QWindow>

Expand Down
2 changes: 1 addition & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ FORMS += mainwindow.ui \
videodialog.ui \
motiondialog.ui

PKGCONFIG += opencv
PKGCONFIG += opencv4
LIBS += -ldc1394 -ljpeg

QMAKE_CXXFLAGS += -std=c++11
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ else {
CONFIG+=qtestlib
}

PKGCONFIG += opencv
PKGCONFIG += opencv4
LIBS += -L../lib -lvidman_debug -ldc1394 -ljpeg

QMAKE_CXXFLAGS += -std=c++11
Expand Down

0 comments on commit f666508

Please sign in to comment.