Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt
Table of Contents
absoluteUrltrue


Introduction

For more information about the software HALCON from MVTecby MVtec, we refer to their office websitethe product owner´s online presence: https://www.mvtec.com/products/halcon/

Info

HALCON can be preinstalled pre-installed on the camera under the location via /opt/halcon and can be acceses via the path variable $HALCONROOT . If not preinstalled pre.installed, please contact you your sales contact.

PDF
namearm_based_platforms.pdf

HALCON for ARM-based Platforms

The offical MVTec document "HALCON for Arm-based Platforms" describes the process of  "compiling/cross-compiling" of HALCON application applications and is linked below.

https://www.mvtec.com/fileadmin/Redaktion/mvtec.com/documentation/manuals/arm_based_platforms.pdf

The document is divided into chapterchapters. For a better orientation we give a short overview:

Chapter 1 Using HALCON on ARM-based Platforms

Gives a general overview of using HALCON on ARM-based platforms.

Chapter 2 Getting Started

Discribes the process of installing HALCON to an ARM-based platform and can be skipped since the HALCON tools are preinstalled pre-installed both on the iam camera and the virtual machine.

Chapter 3 Creating Applications

Describes the process of  of "compiling/cross-compiling" of an HALCON application.

HALCON Examples on iam

camera

You need to open Open an SSH Shell connection to the camera. For some example you also need to have In some cases X-Server support is required.

Code Block
languagebash
ssh -Y root@192.168.1.10

There are some examples preinstalled pre-installed to the iam camera. They can be found under the locationhere:

Code Block
cd /home/root/040530_test_halcon

On top of the filesystem can be found the file system see for README.md.

There are is detailed information about the provided samples.

Structure of the test_HALCON folder:

The folder contains the file system below. On can see that the The three examples do have a similar file structure.

Code Block
.
|-- README.md			
|-- cpp
|   |-- Makefile
|   |-- test_halcon_aniso_test
|   |   |-- bin
|   |   |   |-- aarch64-linux
|   |   |       |-- find_aniso_shape_model
|   |   |-- makefiles
|   |   |   |-- macros.mak
|   |   |   |-- makefile
|   |   |   |-- rules.mak
|   |   |-- source
|   |   |   |-- find_aniso_shape_model.cpp
|   |   |-- vs2010
|   |       |-- test_halcon_aniso.sln
|   |       |-- test_halcon_aniso.suo
|   |       |-- test_halcon_aniso.vcxproj
|   |       |-- test_halcon_aniso.vcxproj.filters
|   |       |-- test_halcon_aniso.vcxproj.user
|   |       |-- x64
|   |           |-- Release
|   |               |-- test_halcon_aniso.exe
|   |-- test_halcon_live_view
|   |   |-- bin
|   |   |   |-- aarch64-linux
|   |   |       |-- test_halcon_live_view
|   |   |-- makefiles
|   |   |   |-- macros.mak
|   |   |   |-- makefile
|   |   |   |-- rules.mak
|   |   |-- source
|   |   |   |-- test_halcon_live_view.cpp
|   |   |-- vs2010
|   |       |-- test_halcon_live_view.sln
|   |       |-- test_halcon_live_view.suo
|   |       |-- test_halcon_live_view.vcxproj
|   |       |-- test_halcon_live_view.vcxproj.filters
|   |       |-- test_halcon_live_view.vcxproj.user
|   |       |-- x64
|   |           |-- Release
|   |               |-- test_halcon_live_view.exe
|   |-- /test_halcon_sw_trigger
|       |-- bin
|       |   |-- aarch64-linux
|       |       |-- test_halcon_sw_trigger
|       |-- makefiles
|       |   |-- macros.mak
|       |   |-- makefile
|       |   |-- rules.mak
|       |-- source
|       |   |-- test_halcon_sw_trigger.cpp
|       |-- vs2010
|           |-- test_halcon_sw_trigger.sln
|           |-- test_halcon_sw_trigger.suo
|           |-- test_halcon_sw_trigger.vcxproj
|           |-- test_halcon_sw_trigger.vcxproj.filters
|           |-- test_halcon_sw_trigger.vcxproj.user
|           |-- x64
|               |-- Release
|                   |-- test_halcon_sw_trigger.exe
|-- profile_halcon



Description of samples:

test_halcon_aniso_test:

This sample is derived from find_aniso_shape_model.hdev (MVTec Software GmbH).
This sample is designed for testing the performance of the FindAnisoShapeModel() function.
With 50 loops a mean value of the consumed time of FindAnisoShapeModel() is evaluated.

OPTIONS:

NO_WINDOWS ; if defined no windows are shown

test_halcon_live_view:

This sample is derived from error_handling_timeout.cpp (MVTec Software GmbH).
This sample is designed for testing the live view of the iam platform.

OPTIONS:

SAVE_IMAGE ; if defined, a image is saved at the end of program
SET_EXPOSURE_TIME ; if defined, a exposure time is set

test_halcon_sw_trigger:

This sample is derived from error_handling_timeout.cpp (MVTec Software GmbH).
This sample is designed to show the software trigger functionality.
This sample aquires 100 software triggered frames.
No live view is implemented.

OPTIONS:

NONE

Execute

Execution of one of the provided HALCON examples

The binarys binaries of the prebuild examples can be found in the ../bin directory of each example project. The test_halcon_live_view can be executed by applying the commands below. The other two other examples can be executed in the same way.

Code Block
languagebash
cd /home/root/040530_test_halcon/cpp/test_halcon_live_view/bin/aarch64-linux/
./test_halcon_live_view
Tip

The test_halcon_live_view example opens a figure showing the camera live image. Therefore it is necessary that the OpenSSH connection allows x11 forwarding!

Info

The two other examples test_halcon_aniso_test and test_halcon_sw_trigger do not need the x11 forwarding.

Compiling the provided HALCON examples

It is possible to compile the examples on a Linux Host system (e.g. by using the provided virtual machine image) or native on the camera (over OpenSSH) both using makefiles.

Tip

For cross - compiling, you have to source profile_halcon:
source .profile_halcon

You can test Test successful sourcing with:
echo $HALCONARCH

You should seeSee then for:
aarch64-linux

The next section described describes the process of building the software trigger project as an example.

Build e.g. the software trigger example

Info

The steps discribed described below are both simillar in the same on native and the cross compile environment.

Navigate into the makefile directory

Code Block
cd /home/root/040530_test_halcon/cpp/test_halcon_sw_trigger/makefiles

Remove the prebuild binary by execute executing the command make make clean and build it from source by make .

Info

For more details: The exact behavior behaviour of both commands are is defined in the makefile.

Code Block
make clean
make

The compiled binary can be found in the ../bin directory and can be executed as follow

Code Block
cd ../bin/aarch64-linux/
./test_halcon_sw_trigger
Info

The other examples test_halcon_live_view and test_halcon_aniso_test or your own project as discribed described in the next section can be build from the source in the same wayaccordingly.

Building your own HALCON examples:

Prepare Makefiles

Possibly the easiest way is to copy the complete folder of one of the examples and rename it to your project name.:

Code Block
cd /home/root/040530_test_halcon/cpp/
mkdir your_project_name
cp -vr test_halcon_sw_trigger/* your_project_name

Now you can edit and rename the given source file from the director your_project_name/source/ or simply replace it by your own cpp file.

Info

On will get a well-arranged file structure if you use the make clean command before further editing your project director. On can achive this by executing the commands below.

Code Block
cd /home/root/040530_test_halcon/cpp/your_project_name/makefiles/
make clean

Code Block
cd /home/root/040530_test_halcon/cpp/your_project_name/source/
mv test_halcon_sw_trigger.cpp your_source_file_name.cpp
Tip

Since you are analysing an For analysis of a monochrome image sensor it is important to use a monochrome pixel fomat. Therefore the given examples do all show how to configure the pixel format in source code. Like the listening from With reference to test_halcon_sw_trigger.cpp below.:

Code Block
try
{
	acqdevice.SetFramegrabberParam("PixelFormat", "Mono8");
}
catch (HException &except)
{
	cout << "---> PixelFormat failed!\n";
	cout << "---> Cause: " << except.ErrorMessage() << "(HALCON error " << except.ErrorCode() << ")\n";
	cout << "---> CloseFramegrabber!\n";
	acqdevice.CloseFramegrabber();
	return except.ErrorCode();
}

You also need to edit Edit the makefile as discribed shown below at in line 38 by with regard to the name naming of your cpp source file.

Code Block
#------------------------------------------------------------------------------
# makefile
#------------------------------------------------------------------------------
# HALCON/C++ examples
#
# ATTENTION:
#
#   This makefile uses gmake syntax and works only with gmake, therefore.
#   On Windows systems you can use nmake with the file makefile.win 
#   which is also provided in this directory
#   The executables are created in the directory 
#   $(HALCONEXAMPLES)/cpp/console/bin$(CONF_SUFFIX)/$(HALCONARCH)
#
# Copyright (c) 1996-2019 by MVTec Software GmbH
#                            www.mvtec.com
#------------------------------------------------------------------------------
# The makefile can be used in the following way:
#    gmake all
#    gmake all XL=1
#    gmake allxl
#    gmake clean
#    gmake <program>
#    gmake <program> XL=1
#    gmake PROG=<program>
#    gmake PROG=<program> XL=1
#    gmake PROG=<program> clean
# Optionally the STATE variable can be set to release or debug, e.g.
#    gmake STATE=debug all
#------------------------------------------------------------------------------
#
#  Make sure that the following environment variables are set correctly:
#    - HALCONROOT
#    - HALCONARCH 
#------------------------------------------------------------------------------

# -- common stuff -------------------------------------------------------------

PROG           = your_source_file_name

ifndef BASE_DIR
BASE_DIR       = ../
endif
ifndef MAKE_DIR
MAKE_DIR       = $(BASE_DIR)makefiles/
endif
ifndef MAKE_FILE
MAKE_FILE      = makefile
endif

ifndef SRC_DIR
SRC_DIR        = $(BASE_DIR)source/
endif

Using make command

Navigate into the makefile directory and execute the make command.

Code Block
cd /home/root/040530_test_halcon/cpp/your_project_name/makefiles
make
Info

You may need to remove your binaries which were built before by execute when executing the command make clean before.

The binary can be found now in the ../bin directory and can be executed by the commands below.

Code Block
cd ../bin/aarch64-linux/
./your_source_file_name


Attachments

Attachments
uploadfalse
sortByname


🔍 References

🔗 related content

👥 contact NET

Insert excerpt
MasterContent: Contact NET
MasterContent: Contact NET
nopaneltrue