Halcon Qt 环境一次性配置

新建 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 己经在安装的时候,加到环境变量中去了。如需发布,自行拷贝,即可。


版权声明:本文为linux_wgl原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。