Step1
- 参考官方教程编译、安装Opencv
- 在/etc/ld.so.conf.d/opencv.conf 中加入/usr/local/lib,然后
sudo ldconfig /etc/ld.so.conf
- 安装Visual Studio,勾选相关组件,参考
- 连接到远程Linux计算机,创建项目,参考
Step2
配置项目属性,我设置的是我个人虚拟机上的绝对路径,仅供参考。
- 配置包含目录
- 配置opencv依赖库,根据实际需要配置
我主要添加了以下项目:opencv_core, opencv_imgproc, opencv_ximgproc, opencv_highgui, opencv_dnn_objdetect, opencv_dnn, opencv_videoio, opencv_calib3d
- 查看命令行是否符合预期
踩坑
1、由于调试时的工作目录默认是
(
R
e
m
o
t
e
O
u
t
D
i
r
)
,
所
以
代
码
中
需
要
读
取
的
文
件
若
以
相
对
路
径
查
找
的
话
,
就
要
以
(RemoteOutDir),所以代码中需要读取的文件若以相对路径查找的话,就要以
(RemoteOutDir),所以代码中需要读取的文件若以相对路径查找的话,就要以(RemoteOutDir)为起始路径,或者改用绝对路径。($(RemoteOutDir)就是生成的.out文件所在的目录)
2、若运行报错error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function ‘cvNamedWindow’则参考,运行以下命令:
apt-get install libgtk2.0-dev pkg-config
apt-get install pkg-config