新建 halcon.pri文件
halcon.pri 内容
INCLUDEPATH += "C:/Program Files/MVTec/HALCON-20.11-Steady/include"
INCLUDEPATH += "C:/Program Files/MVTec/HALCON-20.11-Steady/include/halconcpp"
LIBS += "C:/Program Files/MVTec/HALCON-20.11-Steady/lib/x64-win64/*.lib"
Qt 工程
工程运行
原码
#include "HalconCpp.h"
int main()
{
using namespace HalconCpp;
HImage Mandrill("monkey"); // read image from file "monkey"
Hlong width,height;
Mandrill.GetImageSize(&width,&height);
HWindow w(0,0,width,height); // window with size equal to image
Mandrill.DispImage(w); // display image in window
w.Click(); // wait for mouse click
w.ClearWindow();
HRegion Bright = Mandrill >= 128; // select all bright pixels
HRegion Conn = Bright.Connection(); // get connected components
// select regions with a size of 500 to 90000 pixels
HRegion Large = Conn.SelectShape("area","and",500,90000);
// select the eyes out of the instance variable Large by using
// the anisometry as region feature:
HRegion Eyes = Large.SelectShape("anisometry","and",1,1.7);
Eyes.DispRegion(w); // display result image in window
w.Click(); // wait for mouse click
}
关于运行时库
dll 己经在安装的时候,加到环境变量中去了。如需发布,自行拷贝,即可。