econsystems / opencv_v4l2

This project contains sample OpenCV application code as well as V4L2 helper library to access camera devices in OpenCV. This code helps to achieve high framerates from cameras in OpenCV. This project gives better results than the VideoCapture class in OpenCV. This source code is only compatible in Linux.
BSD 3-Clause "New" or "Revised" License
39 stars 22 forks source link

cannot build due to errors with old versions of OpenCV #7

Open stephanecharette opened 3 years ago

stephanecharette commented 3 years ago

Describe the bug Attempting to build but immediately running into problems due to this code being out-of-date with modern versions of OpenCV. Errors such as:

/home/stephane/src/econsystems_opencv_v4l2/src/opencv_main.cpp: In function ‘int main(int, char**)’:
/home/stephane/src/econsystems_opencv_v4l2/src/opencv_main.cpp:76:10: error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope
   76 |  cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
      |          ^~~~~~~~~~~~~~~~~~~~~~~
/home/stephane/src/econsystems_opencv_v4l2/src/opencv_main.cpp:77:10: error: ‘CV_CAP_PROP_FRAME_HEIGHT’ was not declared in this scope
   77 |  cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
/home/stephane/src/econsystems_opencv_v4l2/src/opencv_main.cpp: In function ‘int main(int, char**)’:
/home/stephane/src/econsystems_opencv_v4l2/src/opencv_main.cpp:76:10: error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope
   76 |  cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
      |          ^~~~~~~~~~~~~~~~~~~~~~~
/home/stephane/src/econsystems_opencv_v4l2/src/opencv_main.cpp:77:10: error: ‘CV_CAP_PROP_FRAME_HEIGHT’ was not declared in this scope
   77 |  cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
/home/stephane/src/econsystems_opencv_v4l2/src/opencv_main.cpp:86:25: error: ‘CV_WINDOW_OPENGL’ was not declared in this scope
   86 |  namedWindow("preview", CV_WINDOW_OPENGL);
      |                         ^~~~~~~~~~~~~~~~

To Reproduce Steps to reproduce the behavior:

git clone git@github.com:econsystems/opencv_v4l2.git
cd opencv_v4l2/
mkdir build
cd build
cmake ..
build -j8

Expected behavior Project builds.

Screenshots image

Desktop (please complete the following information):

Device (please complete the following information):

Myrmecoman commented 2 years ago

A few things changed from opencv 3.X to 4.X. You just have to change cv::CV_CAP_PROP_FRAME_WIDTH to cv::CAP_PROP_FRAME_WIDTH.

You probably found it since then, but the issue is still open and I guess it might help others having the same issue.

LMSAas commented 2 years ago

Did frame_width also solve the other issues?