0、新建一个C++控制台应用ConsoleApplication1,并将平台改为x64,工具栏的【视图】->【其他窗口】->【属性管理器】,双击Microsoft.Cpp.x64.user
1、VC++ 目录->包含目录
2、VC++ 目录->库目录
3、C/C++->附加包含目录
4、链接器->常规->附加库目录
5、链接器->输入->附加依赖项
6、保存
7、测试OpenCV
//打开摄像头样例 #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/core/core.hpp> using namespace cv; int main() { VideoCapture cap(0); Mat frame; while (1) { cap >> frame; imshow("调用摄像头", frame); waitKey(30); } return 0; }
8、测试Halcon
#include "HalconCpp.h" using namespace HalconCpp; int main() { HImage Mandrill("monkey"); Hlong width, height; Mandrill.GetImageSize(&width, &height); HWindow w(0, 0, width, height); Mandrill.DispImage(w); w.Click(); w.ClearWindow(); HRegion Bright = Mandrill >= 128; HRegion Conn = Bright.Connection(); HRegion Large = Conn.SelectShape("area", "and", 500, 90000); HRegion Eyes = Large.SelectShape("anisometry", "and", 1, 1.7); Eyes.DispRegion(w); w.Click(); }