
- 下载Visual Studio Community 2013
- opencv2.4.9
- 下载
- 配置环境变量
- 配置Visual Studio Community 2013
- 新建visual C项目
- 工程目录的配置
- 可能会出现的Bug
- 测试
Visual Studio Community 2013下载链接:Visual Studio Community 2013
opencv2.4.9 下载OpenCV – 2.4.9 – 2014-04-11下载链接:opencv2.4.9
配置环境变量 配置Visual Studio Community 2013 新建visual C项目新建 visual C++项目,如下图所示,项目选项注意:如下图。
view->other windows->preperty manager
Debug|Win32->Win32 User(右键)->preperties
1、包含目录:(VC++目录)
D:Program Filesopencvbuildinclude
D:Program Filesopencvbuildincludeopencv
D:Program Filesopencvbuildincludeopencv2
2、库目录:(VC++目录)D:Program Filesopencvbuildx86vc12lib
连接器->输入->附加依赖项:
opencv_ml249d.lib opencv_calib3d249d.lib opencv_contrib249d.lib opencv_core249d.lib 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可能会出现的Bug
vs2013配置opencv2.4.9后,运行程序。
出现找不到opencv_core249d.dll,opencv_highgui249d.dll,opencv_features2d249d.dll等问题。
解决办法:
将opencv_core249d.dll;opencv_highgui249d.dll等缺失dll文件从“OpenCV的安装路径opencvbuildx86vc12bin”拷贝到C:WINDOWSSYSTEM32和C:WindowsSysWOW64下。这里由部分博客给出的是根据当前电脑位数是32还是64的,我是全部拷贝。
进入cmd,输入regsvr32 C:WindowsSystem32opencv_core249d.dll。
如果还报错的话。
可能是dll文件出现了问题。
解决方案:下载directx修复工具, *** 作教程。记得要重启一下,再运行试试
#include "opencv2/core/core.hpp" #include "highgui.h" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/nonfree/nonfree.hpp" #include "opencv2/legacy/legacy.hpp" #include "opencv2/stitching/detail/autocalib.hpp" #include "opencv2/stitching/detail/blenders.hpp" #include "opencv2/stitching/detail/camera.hpp" #include "opencv2/stitching/detail/exposure_compensate.hpp" #include "opencv2/stitching/detail/matchers.hpp" #include "opencv2/stitching/detail/motion_estimators.hpp" #include "opencv2/stitching/detail/seam_finders.hpp" #include "opencv2/stitching/detail/util.hpp" #include "opencv2/stitching/detail/warpers.hpp" #include "opencv2/stitching/warpers.hpp" #include#include #include using namespace cv; using namespace std; using namespace detail; int main(int argc, char** argv) { Mat img = imread("G://vcproject2.4.9//test_opencv//a.jpg"); //读入图像 Ptr finder; //定义FeaturesFinder类 finder = new SurfFeaturesFinder(); //应用SURF方法 //finder = new OrbFeaturesFinder(); //应用ORB方法 ImageFeatures features; //表示特征 (*finder)(img, features); //特征检测 Mat output_img; //调用drawKeypoints函数绘制特征 drawKeypoints(img, features.keypoints, output_img, Scalar::all(-1)); namedWindow("features", CV_WINDOW_NORMAL); imshow("features", output_img); waitKey(0); return 0; }
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)