【问题标题】:error: use of undeclared identifier 'scale_image_range'?错误:使用未声明的标识符“scale_image_range”?
【发布时间】:2019-09-29 22:48:52
【问题描述】:

我同时使用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能识别这个功能

【问题讨论】:

    标签: c++ qt halcon


    【解决方案1】:

    您必须将 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"
    
    

    【讨论】:

    • 我的朋友,同样感谢你。您的评论与我的问题无关,我的问题是我使用的函数是外部函数,它不是来自 halcon,我需要自己添加外部函数。并且问题已经解决了
    猜你喜欢
    • 1970-01-01
    • 2013-03-12
    • 2014-08-04
    • 2020-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多