OpenCV 4: 'CAP_PROP_POS_FRAMES' was not declared in this scope

asked 2019-09-17 16:51:51 -0600

Tina  J gravatar image

I just installed the latest OpenCV (4.1.2) on a fresh Debian container. I was trying to compile a OpenCV code repo located here. I added the include and link path to the CMakeLists.txt file. I simply removed the CV_ prefix as I'm using OpenCV 4.x now. But I don't know why it still complains. When compiling with make, it complains for the names 'CAP_PROP_POS_FRAMES' was not declared in this scope, similary for CAP_PROP_FRAME_COUNT and CAP_PROP_FPS.

How to solve it?

Full errors:

[ 76%] Built target summengine
[ 80%] Building CXX object CMakeFiles/SimpleVideoSummExample.dir/src/utils/ShotDetector.cc.o
[ 84%] Building CXX object CMakeFiles/SimpleVideoSummExample.dir/src/videoSummarization/SimpleVideoSummarizer.cc.o
/home/Vis-DSS-master/src/utils/ShotDetector.cc: In function 'std::vector<int> shotDetector(cv::VideoCapture&, double, int, int, int)':
/home/Vis-DSS-master/src/utils/ShotDetector.cc:20:51: error: 'CAP_PROP_FPS' was not declared in this scope
     int FRAME_RATE = static_cast<int>(capture.get(CAP_PROP_FPS));
                                                   ^~~~~~~~~~~~
/home/Vis-DSS-master/src/utils/ShotDetector.cc:20:51: note: suggested alternative:
In file included from /usr/local/include/opencv4/opencv2/highgui.hpp:51:0,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui.hpp:48,
                 from /home/Vis-DSS-master/src/utils/ShotDetector.h:12,
                 from /home/Vis-DSS-master/src/utils/ShotDetector.cc:8:
/usr/local/include/opencv4/opencv2/videoio.hpp:137:8: note:   'CAP_PROP_FPS'
        CAP_PROP_FPS            =5, //!< Frame rate.
        ^~~~~~~~~~~~
/home/Vis-DSS-master/src/utils/ShotDetector.cc:29:17: error: 'CAP_PROP_POS_FRAMES' was not declared in this scope
     capture.set(CAP_PROP_POS_FRAMES, 0);
                 ^~~~~~~~~~~~~~~~~~~
/home/Vis-DSS-master/src/utils/ShotDetector.cc:29:17: note: suggested alternative:
In file included from /usr/local/include/opencv4/opencv2/highgui.hpp:51:0,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui.hpp:48,
                 from /home/Vis-DSS-master/src/utils/ShotDetector.h:12,
                 from /home/Vis-DSS-master/src/utils/ShotDetector.cc:8:
/usr/local/include/opencv4/opencv2/videoio.hpp:133:8: note:   'CAP_PROP_POS_FRAMES'
        CAP_PROP_POS_FRAMES     =1, //!< 0-based index of the frame to be decoded/captured next.
        ^~~~~~~~~~~~~~~~~~~
/home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.cc: In constructor 'SimpleVideoSummarizer::SimpleVideoSummarizer(char*, int, int, int)':
/home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.cc:20:46: error: 'CAP_PROP_FPS' was not declared in this scope
     frameRate = static_cast<int>(capture.get(CAP_PROP_FPS));
                                              ^~~~~~~~~~~~
/home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.cc:20:46: note: suggested alternative:
In file included from /usr/local/include/opencv4/opencv2/highgui.hpp:51:0,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui.hpp:48,
                 from /home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.h:12,
                 from /home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.cc:7:
/usr/local/include/opencv4/opencv2/videoio.hpp:137:8: note:   'CAP_PROP_FPS'
        CAP_PROP_FPS            =5, //!< Frame rate.
        ^~~~~~~~~~~~
/home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.cc:21:31: error: 'CAP_PROP_FRAME_COUNT' was not declared in this scope
     videoLength = capture.get(CAP_PROP_FRAME_COUNT) / frameRate;
                               ^~~~~~~~~~~~~~~~~~~~
/home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.cc:21:31: note: suggested alternative:
In file included from /usr/local/include/opencv4/opencv2/highgui.hpp:51:0,
                 from /usr/local/include/opencv4/opencv2/highgui/highgui.hpp:48,
                 from /home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.h:12,
                 from /home/Vis-DSS-master/src/videoSummarization/SimpleVideoSummarizer.cc:7:
/usr/local/include/opencv4/opencv2/videoio.hpp:139:8: note:   'CAP_PROP_FRAME_COUNT'
        CAP_PROP_FRAME_COUNT    =7, //!< ...
(more)
edit retag flag offensive close merge delete

Comments

Please use documentation and sample. cmake samples here

LBerger gravatar imageLBerger ( 2019-09-18 01:47:50 -0600 )edit