高博第9讲project opencv viz模块

报错:

/home/yk/桌面/slambook-master/project/0.2/test/run_vo.cpp:6:28: fatal error: opencv2/viz.hpp: 没有那个文件或目录
compilation terminated.
test/CMakeFiles/run_vo.dir/build.make:62: recipe for target 'test/CMakeFiles/run_vo.dir/run_vo.cpp.o' failed
make[2]: *** [test/CMakeFiles/run_vo.dir/run_vo.cpp.o] Error 1
CMakeFiles/Makefile2:140: recipe for target 'test/CMakeFiles/run_vo.dir/all' failed
make[1]: *** [test/CMakeFiles/run_vo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

问题:fatal error: opencv2/viz.hpp: No such file or directory 报错,估计是缺少viz模块,之前安装的是OPENCV3.2.0版本应该没什么问题的,可是现在缺少模块就把缺少的重新编译安装下吧。
解决:看到OPENCV官网上有解决方法,结合自己之前的安装过程,把解决过程梳理下:
在这里插入图片描述

1、找到自己当时解压后的opencv3.2源码,当时编译时自己新建了一个build文件夹,编译后的文件都放在这个文件夹里面,所以进到该文件夹中,开始操作。
2、安装依赖

sudo apt-get isntall libvtk5-dev

3、cmake时候加上-DWITH_VTK=ON这个参数

 cmake -DWITH_VTK=ON ..

4、编译(时间挺长的)

make -j4

5、安装

sudo make install

就完事了,再次编译刚才缺少模块的项目,发现不报错,编译成功了。

转载参考:https://blog.csdn.net/weixin_42226918/article/details/85843848

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值