【已解决】error: ‘CV_GRAY2BGR’ was not declared in this scope
这是运行高翔 slambook2 代码出现的问题,有两种方法解决。
error: ‘CV_GRAY2BGR’ was not declared in this scope
/home/diyu/slambook2/ch8/optical_flow.cpp: In function ‘int main(int, char**)’:
/home/diyu/slambook2/ch8/optical_flow.cpp:145:37: error: ‘CV_GRAY2BGR’ was not declared in this scope
145 | cv::cvtColor(img2, img2_single, CV_GRAY2BGR);
| ^~~~~~~~~~~
/home/diyu/slambook2/ch8/direct_method.cpp: In function ‘void DirectPoseEstimationSingleLayer(const cv::Mat&, const cv::Mat&, const VecVector2d&, std::vector<double, std::allocator >, Sophus::SE3d&)’:
/home/diyu/slambook2/ch8/direct_method.cpp:206:35: error: ‘CV_GRAY2BGR’ was not declared in this scope
206 | cv::cvtColor(img2, img2_show, CV_GRAY2BGR);
| ^~~~~~~~~~~
make[2]: *** [CMakeFiles/optical_flow.dir/build.make:63:CMakeFiles/optical_flow.dir/optical_flow.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:105:CMakeFiles/optical_flow.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务…
make[2]: *** [CMakeFiles/direct_method.dir/build.make:63:CMakeFiles/direct_method.dir/direct_method.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:78:CMakeFiles/direct_method.dir/all] 错误 2
make: *** [Makefile:84:all] 错误 2
这个实验由于代码使用的是opencv2,而cmkelists.txt文件中是opencv4
error: ‘CV_GRAY2BGR’ was not declared in this scope
这是opencv2的用法,现在opencv3和4是COLOR_GARY2BGR
因此有两种选择
要么将代码中opencv2的用法改成opencv3或者4的用法。即将代码中的CV_GRAY2BGR改成COLOR_GRAY2BGR,这里不确定是不是只需修改这个就可以。
要么将cmakelists文件中的opencv4改成opencv2。
这里选择第二种做法,修改成opencv2
【已解决】error: ‘CV_GRAY2BGR’ was not declared in this scope相关推荐
- 解决[Error] ‘i‘ was not declared in this scope
解决 想必大家都遇到过这种报错 这是为什么呢? #include<iostream> using namespace std; int main() {int sum=0;for(i=0; ...
- 【已解决】‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
'CV_LOAD_IMAGE_GRAYSCALE' was not declared in this scope 由于OpenCV版本差异导致变量没有定义 'CV_LOAD_IMAGE_GRAYSCA ...
- 【C++】mingw32-make+cmake:error: ‘nullptr‘ was not declared in this scope解决方法
###问题 使用cmake成功(Configuring done Generating done)后,在cmd终端中执行 mingw32-make报错: error: 'nullptr' was no ...
- 解决Cygwin编译cocos2dx 遇到的 error: 'UINT64_C' was not declared in this scope 问题
环境工具:Win10.VS2013.cocos2d-x-2.2.6.Cygwin.ADT 问题来源:写了一个小游戏,VS2013上运行成功,就尝试着打包apk,项目导入到ADT里面,添加了cocos2 ...
- 已解决ERROR: Cannot find command ‘git’- do you have ‘git’ installed and in your PATH?
已解决ERROR: Cannot find command 'git'- do you have 'git' installed and in your PATH?异常的正确解决方法,亲测有效!!! ...
- 已解决error:stray‘\243‘in program异常的正确解决方法,亲测有效!!!
已解决error:stray'\243'in program异常的正确解决方法,亲测有效!!! 文章目录 报错问题 解决方法 福利 报错问题 粉丝群里面的一个小伙伴敲代码时发生了报错(当时他心里瞬间凉 ...
- error: ‘CV_RGB2GRAY’ was not declared in this scope 的解决方法
error: 'CV_RGB2GRAY' was not declared in this scope 的解决方法 参考文章: (1)error: 'CV_RGB2GRAY' was not decl ...
- Windows网络编程 c语言 报错:[Error] ‘bzero‘ was not declared in this scope
阅读前请看一下:我是一个热衷于记录的人,每次写博客会反复研读,尽量不断提升博客质量.文章设置为仅粉丝可见,是因为写博客确实花了不少精力.希望互相进步谢谢!! 文章目录 阅读前请看一下:我是一个热衷于记 ...
- ndk error: malloc was not declared in this scope
error: 'malloc' was not declared in this scope 解决方法: NDK_TOOLCHAIN_VERSION=4.8 APP_CPPFLAGS += -frtt ...
最新文章
- Spark中常用的算法
- 幼儿园体育游戏电子计算机教案,幼儿园大班体育游戏教案
- 真格量化——做空波动率策略
- rabbitmq详细入门文档+springboot结合使用
- 如何给U盘设置一张妖娆又骚气的图标
- Canny边缘检测算法原理及其VC实现详解(一)
- 在Windows XP中轻松发传真
- Windows server 2008 R2搭建主域控制器 + 辅域控制器
- 微软自带的防反编译工具dotfuscator.exe的使用
- ICRA 2021| 基于精确和减少漂移的关注距离的Camera-IMU-UWB融合定位方法
- 逆袭?或将掌舵万亿SaaS巨头的Taylor竟是“天选之人”
- tensorflow 2.5.0 ( keras )搭建wgan-gp 和 div
- 《Android进阶之光》--Dagger2
- HTML5权威指南pdf
- html5创新创业模板,大学生创新创业计划书模板完整版.doc
- oralce 表字段扩容(修改表字段长度)
- win安装android系统服务,拯救你的旧电脑:整个win+Android的双系统
- 暨阳社区创始人游牧:为什么我们要转型?
- javax.el.PropertyNotFoundException: Property ‘XXX‘ not found on type xx.xx.xx.xx问题解决(el表达式))
- mac安装golang,编写第一个go程序
热门文章
- dapper(dapper框架)
- Java web系统打包成exe安装文件
- 疯狂springboot终极讲义笔记(二)
- 12 道腾讯前端面试真题及答案整理
- DELL 电脑 重装系统出现 no boottable devices found
- python Flask 编写 api 接口,CORS 解决 flask 跨域问题
- 在知乎上看到的一个关于Linux运维工程师必知的几点,希望对有志于从事运维工作的你有帮助
- 福建农林大学计算机与信息学院副书记,福建农林大学计算机与信息学院导师介绍:钟一文...
- C语言学生成绩信息管理系统课程设计报告
- 2019全国计算机模拟题,2019年全国计算机二级Java考试模拟习题3