数字图像处理(一)前言
本学期大部分时间在公司实习,所以只能趁在学校的时间做下作业,在这里开个坑,也算给后人留个福利,能空出时间复习考研。
简单介绍下实验环境配置:
VS2012+OpenCV2.4.9+MFC
之前在公司配置VS2019+OpenCV4.0.1的环境,怎么配都配不好,索性用旧电脑搭建环境。
OpenCV对VS版本有要求,VS版本要高于OpenCV这个路径下的文件夹版本
安装好OpenCV后先要在系统里配置环境变量,这里不多叙述,自行上网搜索
新建MFC工程,设置向导里选择基于对话框,并取消使用Unicode库
(CSDN的编辑器真难用……)
这里全部不选,之后直接点击完成
建好后工程如图所示,下一步配置OpenCV库
右键工程,选择属性,在VC++目录里的包含目录和库目录把路径填进去
然后在左上角选择配置下拉框,选择Release按照上面教程再填一遍,路径是一样的
下一步打开链接器——输入——附加依赖项,照着下面的分别填进去
DeBug的附加依赖项:
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
Release的附加依赖项:
opencv_objdetect249.lib
opencv_ts249.lib
opencv_video249.lib
opencv_nonfree249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_videostab249.lib
opencv_calib3d249.lib
opencv_contrib249.lib
opencv_core249.lib
opencv_features2d249.lib
opencv_flann249.lib
opencv_gpu249.lib
opencv_highgui249.lib
opencv_imgproc249.lib
opencv_legacy249.lib
opencv_ml249.lib
之后点击应用,环境就配好了,下一步在stdafx.h头文件里加入OpenCV的头文件
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<opencv2\opencv.hpp>
如果不报错就算大功告成,这一篇就到这里,以后如果有遗漏再做补充。
上一篇: PHP 图像尺寸调整代码_PHP教程
下一篇: 四、图像增强系列------线性增强