运行环境配置:win10 64位+matlab2013a+VS2010+OpenCV2.4.9
win版本的OpenCV2.4.9下载链接:https://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.9/opencv-2.4.9.exe/download
(注意:下载地址和安装时最好不要放在带空格的文件夹下,否则compile.m运行时会找不到)
VS2010中配置OpenCV:
参考:https://blog.csdn.net/qq_17783559/article/details/82632188
https://blog.csdn.net/qq_35177575/article/details/72972036
系统环境变量:在系统环境变量Path后添加:
D:\opencv\build\x86\vc10\bin
D:\opencv\build\x64\vc10\bin(根据具体安装路径修改)
工程库目录的配置:
文件->新建->项目->Win32控制台应用程序->命名->路径->确定->下一步->空项目->完成
解决方案资源管理器->源文件->右键->添加->新建项->C++文件->命名->添加
菜单栏视图->属性管理器->双击Microsoft.Cpp.x64.user
工程属性包含路径:通用属性->VC++目录->包含目录->分别添加
D:\opencv\build\include
D:\opencv\build\include\opencv
D:\opencv\build\include\opencv2 (根据具体安装路径修改)
工程属性库路径:分别添加
D:\opencv\build\x86\vc10\lib
D:\opencv\build\x64\vc10\lib(根据具体安装路径修改)
链接器配置:链接器->输入->附加依赖项->分别添加以下19项(Debug模式)
opencv_features2d249d.lib
opencv_flann249d.lib
opencv_gpu249d.lib
opencv_highgui249d.lib
opencv_imgproc249d.lib
opencv_legacy249d.lib
opencv_objdetect249d.lib
opencv_ts249d.lib
opencv_video249d.lib
opencv_nonfree249d.lib
opencv_ocl249d.lib
opencv_photo249d.lib
opencv_stitching249d.lib
opencv_superres249d.lib
opencv_videostab249d.lib
测试配置是否成功:
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;
void main()
{
Mat image, grayImage;
image=imread("D:\\Program Files (x86)\\opencv\\sources\\samples\\0001.jpg", IMREAD_COLOR); //图片索引地址自行修改
cvtColor(image, grayImage, COLOR_RGB2GRAY,0);
imshow("Original Image", image);
imshow("Gray Image", grayImage);
cout <<"Image Size: "<< image.size << endl;
cout <<"Original Image Channels: "<< image.channels() << endl;
cout << "Gray Image Channels: "<<grayImage.channels() << endl;
waitKey(0);
}
测试结果:图片正常显示,配置成功
CSR-DCF运行:
参考:https://blog.csdn.net/qq_17783559/article/details/82025118
打开compile.m修改OpenCV安装路径(注意:路径一定一定不要有空格(吐血ing 感谢大佬师兄o(╥﹏╥)o)
命令框输入 mex -setup选择编译器:
运行compile.m
打开demo_csr.m,修改跟踪算法的存放路径和图像序列存放路径,运行即可得到结果