Support Support Home » Vision Libraries » MVTec HALCON

MVTec HALCON

Architecture

HALCON is the comprehensive standard software for machine vision with an integrated development environment (IDE) that is used worldwide.
It serves all industries with an extensive library of more than 1600 operators for blob analysis, morphology, matching, measuring, identification, and 3D vision, to name just a few.
The full library can be accessed from common programming languages like C, C++, C#, Visual Basic .NET, and Delphi.
HALCON guarantees hardware independence by providing interfaces to hundreds of industrial cameras and frame grabbers, including GenICam, GigE Vision, and IIDC 1394.
For more information please visit MVTec website.

XIMEA provides an Image Acquisition Interface to HALCON through XIMEA GenICam GenTL Producer interface.
Because HALCON supports GenICam standard, all the necessary camera configuration and image acquisition is fully supported by this interface.
The currently supported version is 11.0.

Installation

The installation consists of two steps:

1) Install HALCON software - either the full or the runtime version, depending on whether you need a developing environment or just to run an already compiled application.

2) Installation of XIMEA API Software Package, which contains XIMEA GeniCam GenTL Producer.

Installation of HALCON

Installation of XIMEA API Software Package

Using HALCON Image Acquisition Interface

Since the XIMEA Image Acquisition Interface for HALCON is based on the GenICam standard, the camera features that are defined in its XML follow the GenICam SFNC specification.
GenICam SFNC provides the definitions of standard use cases and standard features.
Its goal is to cover and standardize the naming conventions of the features that are commonly used in cameras allowing user to write generic software for a whole class of cameras.
The SFNC datasheets are available for download on the EMVA website.

HALCON has incorporated the GenICam interface into its software framework the features defined in the SFNC are available through the set_framegrabber_param() function.
Note that SFNC standard contains a vast number of different features, not all of which relate to our cameras.
XIMEA GenICam interface supports only a subset that is defined in the camera XML file.
In general, XIMEA GenICam interface implements all the mandatory and some of the recommended and optional SFNC features, covering all the camera's functionality - Acquisition Parameters, Digital I/O, LUT, Hardware Triggering and so forth.
The features that are supported can be queried by HALCON function: get_framegrabber_param(...,'available_param_names',...).

Demo Applications

Demo applications with source code are not maintained and available only on request.

HALCON HDevelop Application Examples

Although the supported camera parameters can be queried and their description can be found in SFNC an example HALCON program might prove to be a good jump start in your own application.
Below are several HALCON software application examples trying to cover the most frequent user cases.
The main purpose of these examples is to show the proper camera configuration and image acquisition.
Therefore the use of HALCON vision functions () is reduced - yet there is always a comment indicating where those functions are supposed to be implemented.

  • 1) Continuous acquisition with basic camera parameters configuration
* Close All Opened Framegrabbers
close_all_framegrabbers()

* Open the GenICam Framegrabber
info_framegrabber('GenICamTL','info_boards', Information, ValueList)
open_framegrabber ('GenICamTL', 1, 1, 0, 0, 0, 0, 'progressive', -1, 'default', -1, 'false', 'default', ValueList, 0, -1, AcqHandle)

* Set Acquisition Parameters
set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'Continuous')
set_framegrabber_param (AcqHandle, 'ExposureTime', 15000)

* Start Image Acquisition
grab_image_start (AcqHandle, -1)

* Acquire 5 images 
for Index := 1 to 5 by 1
    grab_image_async (Image, AcqHandle, -1)
    * Insert required image vision processing here
endfor
close_framegrabber (AcqHandle)
  • 2) Continuous acquisition with advanced camera parameters configuration
* Close All Opened Framegrabbers
close_all_framegrabbers()

* Open the GenICam Framegrabber
info_framegrabber('GenICamTL','info_boards', Information, ValueList)
open_framegrabber ('GenICamTL', 1, 1, 0, 0, 0, 0, 'progressive', -1, 'default', -1, 'false', 'default', ValueList, 0, -1, AcqHandle)

* Set Acquisition Parameters
set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'Continuous')
set_framegrabber_param (AcqHandle, 'ExposureTime', 10000)
set_framegrabber_param (AcqHandle, 'Gain', 6.15)

* Set Image Binning 2x2
set_framegrabber_param (AcqHandle, 'BinningHorizontal', 2)
set_framegrabber_param (AcqHandle, 'BinningVertical', 2)

* Set ROI
set_framegrabber_param (AcqHandle, 'Width', 500)
set_framegrabber_param (AcqHandle, 'Height', 500)
set_framegrabber_param (AcqHandle, 'OffsetX', 100)
set_framegrabber_param (AcqHandle, 'OffsetY', 100)

* Start Image Acquisition
grab_image_start (AcqHandle, -1)

* Acquire 5 images 
for Index := 1 to 5 by 1
    grab_image_async (Image, AcqHandle, -1)
    * Insert required image vision processing here
endfor
close_framegrabber (AcqHandle)
  • 3) Continuous acquisition in Hardware Trigger Mode with Strobe Out signal
* Close All Opened Framegrabbers
close_all_framegrabbers()

* Open the GenICam Framegrabber
info_framegrabber('GenICamTL','info_boards', Information, ValueList)
open_framegrabber ('GenICamTL', 1, 1, 0, 0, 0, 0, 'progressive', -1, 'default', -1, 'false', 'default', ValueList, 0, -1, AcqHandle)

* Set Acquisition Parameters
set_framegrabber_param (AcqHandle, 'AcquisitionMode', 'Continuous')
set_framegrabber_param (AcqHandle, 'ExposureTime', 15000)

* Increase the Image Acquisition Timeout to 15s - due to the use of Trigger
set_framegrabber_param (AcqHandle, 'grab_timeout', 15000)

* Set Line6 = GPI3 as Trigger Source for Image Acquisition
* Note that the Digital I/O Line numbering depends on the type of camera
set_framegrabber_param (AcqHandle, 'TriggerSource', 'Line6')

* Turn on Trigger Mode Acquisition 
set_framegrabber_param (AcqHandle, 'TriggerMode', 'On')

* Set Line3 = GPO4 to Exposure Active output
set_framegrabber_param (AcqHandle, 'LineSelector', 'Line3')
set_framegrabber_param (AcqHandle, 'LineSource', 'ExposureActive')

* Set Line0 = GPO1 to certain value
set_framegrabber_param (AcqHandle, 'LineSelector', 'Line0')
set_framegrabber_param (AcqHandle, 'LineSource', 'UserOutput0')
set_framegrabber_param (AcqHandle, 'UserOutputSelector', 'UserOutput0')
set_framegrabber_param (AcqHandle, 'UserOutputValue', 0) *set to zero
set_framegrabber_param (AcqHandle, 'UserOutputValue', 1) *set to one

* Start Image Acquisition
grab_image_start (AcqHandle, -1)

* Acquire 5 images 
for Index := 1 to 5 by 1
    grab_image_async (Image, AcqHandle, -1)
    * Insert required image vision processing here
endfor
close_framegrabber (AcqHandle)

USB3 Vision Compliant

More information found through this Link