0

I'm using Halcon and QT together,and i export the algorithm in halcon into c++,then i put the exported code in QT.

I found the function "scale_image_range" can not be recognised. How to solve this problem?

i try to add the #include "HalconCpp.h", #include "HDevThread.h" using namespace HalconCpp; to my code. but it doesn't work

some codes are as follows

    #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);**

     .............................

}

}

i hope this function could be recognized by the QT

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
H Mang
  • 1
  • 1

1 Answers1

0

You have to add the include directories of the HALCON installation to your .pro file so that Qt can recognize HALCON functions. HALCON provides a standard example that shows how to integrate HALCON in a Qt application. After installing HALCON you can find the example here (Windows): %HALCONEXAMPLES%\cpp\qt\Matching

As mentioned above the most important part for you is the .pro file there you need to specify the following:

#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"

Kilian Hohm
  • 320
  • 1
  • 7
  • my friend,thank you the same . Your comment is not related to my problem, my problem is that the function i use is external function and it is not from halcon, i need to add the external function myself. and the problem has been solved – H Mang May 18 '19 at 13:03