[英]OpenCV4 error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope
I recently migrated from OpenCV3.3 to the latest version OpenCV4 on my Ubuntu 18.04 LTS. 我最近在Ubuntu 18.04 LTS上从OpenCV3.3迁移到了最新版本的OpenCV4。 I have some persistent issues with the installation. 我的安装存在一些永久性问题。 My installation did not give any errors when I followed this installation tutorial. 遵循本安装教程时,我的安装未出现任何错误。 But whenever I include the module opencv2/highgui.hpp
in my project, I get problems like below. 但是,每当我在项目中包含模块opencv2/highgui.hpp
时,都会遇到如下问题。 This seems to be an issue caused by highgui.hpp when I followed this link. 当我点击此链接时,这似乎是由highgui.hpp引起的。
/home/arun/Documents/AutonomousLaneDetection/app/main.cpp: In function ‘int main(int, char**)’:
/home/arun/Documents/AutonomousLaneDetection/app/main.cpp:118:36: error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope
int videoWidth = videofile.get(CV_CAP_PROP_FRAME_WIDTH);
^~~~~~~~~~~~~~~~~~~~~~~
/home/arun/Documents/AutonomousLaneDetection/app/main.cpp:119:37: error: ‘CV_CAP_PROP_FRAME_HEIGHT’ was not declared in this scope
int videoHeight = videofile.get(CV_CAP_PROP_FRAME_HEIGHT);
^~~~~~~~~~~~~~~~~~~~~~~~
/home/arun/Documents/AutonomousLaneDetection/app/main.cpp:123:27: error: ‘CV_FOURCC’ was not declared in this scope
CV_FOURCC('M', 'J', 'P', 'G'), 10,
^~~~~~~~~
/home/arun/Documents/AutonomousLaneDetection/app/main.cpp:123:27: note: suggested alternative: ‘CV_BLUR’
CV_FOURCC('M', 'J', 'P', 'G'), 10,
^~~~~~~~~
CV_BLUR
Those constants have been changed in name and location in OpenCV for some time now. 这些常量在OpenCV中的名称和位置已经更改了一段时间。
For the capture properties, they no longer begin with CV_
, so remove that prefix from all of them. 对于捕获属性,它们不再以CV_
,因此请从所有前缀中删除该前缀。 You can find a list of all available capture properties here , note that they all simply start with CAP_PROP_
. 您可以在此处找到所有可用捕获属性的列表,请注意,它们都以CAP_PROP_
开头。
The FOURCC
code constructor is a method on the VideoWriter
class now, so you should use VideoWriter::fourcc(...)
. FOURCC
代码构造函数现在是VideoWriter
类的方法,因此您应该使用VideoWriter::fourcc(...)
。 The docs can be found here . 这些文档可以在这里找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.