Qt+Halcon joint development and configuration

Halcon is an excellent commercial image processing software, but it has a poor experience in visualization; Qt has powerful functions and convenience in visualization and interface development. I have done some software development work before, and now I am using Halcon to develop image processing algorithm. Isn't it a very interesting thing to combine the two!
  therefore, I checked the joint development of Qt+Halcon on the Internet and found that many of them were unclear or complex. In fact, Halcon's own official routine has given a case of joint development of Qt+Halcon. Interested netizens can check it by themselves.
Location (according to the Halcon installation position):

I've talked so much. What blog post? My writing is so poor. I spit when I look at it
get down to business

I problem

Configuring Halcon development environment under Qt

II Solution

  here, we mainly introduce how to configure Halcon development environment under Qt in 2:
Method 1:
Like the development environment of configuring OpenCV under Qt, it is realized by adding libraries. Specific steps "above figure":

If you are too lazy to add it yourself, you can copy it directly, and then change the relevant path to your Halcon installation path

 1 # *******************************Configure Halcon under Qt*****************************
 2 INCLUDEPATH += D:/Software/MVTec/HALCON-17.12-Progress/include\
 3                D:/Software/MVTec/HALCON-17.12-Progress/include/halconcpp
 5 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhalcon
 6 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhalconc
 7 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhalconcpp
 8 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhalconcppxl
 9 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhalconcxl
10 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhalconxl
11 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhdevenginecpp
12 LIBS += -L$$PWD/../../../../Software/MVTec/HALCON-17.12-Progress/lib/x64-win64/ -lhdevenginecppxl

Method 2:
This method is not a method, but it is the simplest and most practical.
Because the relevant path of Halcon has been added to the system environment variable when installing Halcon, it is not necessary to add library files one by one as in method 1. Just Ctrl+C the following content to The pro file is OK.

 1 # *************************Qt configuring Halcon*****************************
 2 # MacOS specific settings. Note that while dyld will search under
 3 # /Library/Frameworks by default, the preprocessor/compiler/linker will not
 4 # and need to be told explicitly.
 5 macx {
 6   QMAKE_CXXFLAGS += -F/Library/Frameworks
 7   QMAKE_LFLAGS   += -F/Library/Frameworks
 8   LIBS           += -framework HALCONCpp
 9 }
10 else {
11   #defines
12   win32:DEFINES += WIN32
14   #includes
15   INCLUDEPATH   += "$$(HALCONROOT)/include"
16   INCLUDEPATH   += "$$(HALCONROOT)/include/halconcpp"
18   #libs
20   unix:LIBS     += -lhalconcpp -lhalcon -lXext -lX11 -ldl -lpthread
21   win32:LIBS    += "$$(HALCONROOT)/lib/$$(HALCONARCH)/halconcpp.lib" \
22                    "$$(HALCONROOT)/lib/$$(HALCONARCH)/halcon.lib"
23 }

This configuration is available for each operating system.

III reference resources

  • Halcon official routine
  • Online users who share, share first

Tags: Qt Halcon

Posted by lol on Mon, 09 May 2022 07:48:11 +0300