繁体   English   中英

OpenCV4错误:在此范围内未声明“ CV_CAP_PROP_FRAME_WIDTH”

[英]OpenCV4 error: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope

我最近在Ubuntu 18.04 LTS上从OpenCV3.3迁移到了最新版本的OpenCV4。 我的安装存在一些永久性问题。 遵循安装教程时,我的安装未出现任何错误。 但是,每当我在项目中包含模块opencv2/highgui.hpp时,都会遇到如下问题。 当我点击链接时,这似乎是由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

这些常量在OpenCV中的名称和位置已经更改了一段时间。

对于捕获属性,它们不再以CV_ ,因此请从所有前缀中删除该前缀。 您可以在此处找到所有可用捕获属性的列表,请注意,它们都以CAP_PROP_开头。

FOURCC代码构造函数现在是VideoWriter类的方法,因此您应该使用VideoWriter::fourcc(...) 这些文档可以在这里找到。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM