c++ - 错误:使用未声明的标识符“scale_image_range”?
问题描述
我同时使用 Halcon 和 QT,我将 halcon 中的算法导出到 C++ 中,然后将导出的代码放入 QT 中。
我发现无法识别功能“scale_image_range”。如何解决这个问题呢?
我尝试使用命名空间 HalconCpp 添加#include "HalconCpp.h"、#include "HDevThread.h";到我的代码。但它不起作用
部分代码如下
#include "mainwindow.h"
#include "HalconCpp.h"
#include "HDevThread.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QDir>
#include <QRadioButton>
using namespace std;
using namespace HalconCpp;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
..............................
}
MainWindow::~MainWindow()
{
delete ui;
}
////Slot function of button "Read"
void MainWindow::on_pushButton_clicked()
{
....................
}
//Slot function of button "Detect"
void MainWindow::on_pushButton_2_clicked()
{
if(ui->radioButton->isChecked())
{
................................
}
if(ui->radioButton_2->isChecked())
{
...........
**scale_image_range(ho_img2, &ho_img3, 20, 220);**
.............................
}
}
我希望这个功能可以被 QT 识别
解决方案
您必须将 HALCON 安装的包含目录添加到您的 .pro 文件中,以便 Qt 可以识别 HALCON 函数。HALCON 提供了一个标准示例,展示了如何将 HALCON 集成到 Qt 应用程序中。安装 HALCON 后,您可以在此处找到示例(Windows):%HALCONEXAMPLES%\cpp\qt\Matching
如上所述,对您来说最重要的部分是 .pro 文件,您需要在其中指定以下内容:
#includes
INCLUDEPATH += "$$(HALCONROOT)/include"
INCLUDEPATH += "$$(HALCONROOT)/include/halconcpp"
#libs
QMAKE_LIBDIR += "$$(HALCONROOT)/lib/$$(HALCONARCH)"
unix:LIBS += -lhalconcpp -lhalcon -lXext -lX11 -ldl -lpthread
win32:LIBS += "$$(HALCONROOT)/lib/$$(HALCONARCH)/halconcpp.lib" \
"$$(HALCONROOT)/lib/$$(HALCONARCH)/halcon.lib"
推荐阅读
- mongodb - mongodb突然要关闭监听套接字
- reactjs - 如何在反应中将图像动画到页面中心
- java - 在 Spring Hibernate 中处理超过 1000 条记录更新
- reactjs - UseState 使用旧值第二次更新了钩子
- linux - 如何通过 bash 向程序发送快捷方式?
- c# - 标题和 DATE.NOW 后的首字母缩略词
- java - 如何让计数器在android studio中递增
- python - random.seed AttributeError:模块“随机”没有属性“randrange”
- python - 如何集成 2 个 keras 模型输出?
- dictionary - 在地图中插入对