Qt 联合Halcon配置
配置
选择添加库
选择外部库
LIBS += -L'C:/Program Files/MVTec/HALCON-17.12-Progress/lib/x64-win64/'
LIBS += -lhalconcpp\
-lhdevenginecpp\
-lhalcon
INCLUDEPATH += 'C:/Program Files/MVTec/HALCON-17.12-Progress/include'
DEPENDPATH += 'C:/Program Files/MVTec/HALCON-17.12-Progress/include'
代码
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
HalconCpp::HObject m_oImg;
HalconCpp::ReadImage(&m_oImg,("code3906.png"));
HalconCpp::OpenWindow(0,0,480,640,0,"visible","black",&hWnd);
HalconCpp::DispImage(m_oImg,hWnd);
}
窗口绑定
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
//获取窗口ID
Hlong WidgetId=ui->widget->winId();
HalconCpp::HObject m_oImg;
HalconCpp::ReadImage(&m_oImg,("code3906.png"));
HalconCpp::OpenWindow(0,0,ui->widget->width(),ui->widget->height(),WidgetId,"visible","black",&hWnd);
//显示灰度图
//HalconCpp::DispImage(m_oImg,hWnd);
//显示图像
HalconCpp::DispObj(m_oImg,hWnd);
}
原文地址:https://blog.csdn.net/weixin_45672157/article/details/144411124
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!