gpt4 book ai didi

OpenCV4错误: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope

转载 作者:行者123 更新时间:2023-12-02 07:10:16 27 4
gpt4 key购买 nike

我最近在 Ubuntu 18.04 LTS 上从 OpenCV3.3 迁移到最新版本 OpenCV4。我在安装过程中遇到了一些持续存在的问题。当我按照 this 进行安装时,我的安装没有出现任何错误。安装教程。但是每当我在项目中包含模块 opencv2/highgui.hpp 时,我就会遇到如下问题。这似乎是我关注 this 时由 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_ 开头,因此请从所有属性中删除该前缀。您可以找到所有可用捕获属性的列表 here ,请注意,它们都只是以 CAP_PROP_ 开头。

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

关于OpenCV4错误: ‘CV_CAP_PROP_FRAME_WIDTH’ was not declared in this scope,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56572665/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com