首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OpenCV4错误:未在此范围内声明‘CV_CAP_PROP_FRAME_WIDTH’

OpenCV4错误:未在此范围内声明‘CV_CAP_PROP_FRAME_WIDTH’
EN

Stack Overflow用户
提问于 2019-06-13 10:39:42
回答 1查看 11.7K关注 0票数 9

我最近在我的Ubuntu18.04LTS上从OpenCV3.3迁移到了最新版本的OpenCV4。我在安装过程中遇到了一些持续的问题。当我按照this安装教程操作时,我的安装没有给出任何错误。但是,每当我在项目中包含模块opencv2/highgui.hpp时,我都会遇到如下问题。当我关注this链接时,这似乎是由highgui.hpp引起的问题。

代码语言:javascript
复制
/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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-13 10:53:12

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

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

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

票数 17
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56572665

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档