Operator Reference
Image
This chapter contains operators regarding the handling of images.
In order to understand the different types of images you can process in HALCON, the three components of an image (pixels, channels and domain) are explained in the following paragraphs.
To learn more about the basic concept of images in HALCON you can also
see the example program halcon_basic_concepts.hdev
.
Pixels
In HALCON pixels can be used in order to represent information of various
kinds. Therefore different pixel types are distinguished.
The following table lists the different pixel types and the corresponding
standard image types for images. Note that this list is not exclusive (e.g.,
a gray value image can be of multiple other image types as well).
You can convert the image type using
.
convert_image_type
Pixel Type | Standard Image Type |
---|---|
Gray Values | byte, uint2 |
Difference | int1, int2 |
2D Histogram | int4
|
Edge Directions | direction |
Derivatives | real |
Fourier Transform | complex |
Hue Values | cyclic |
Vector Field | vector_field
|
Note that the image type vector_field
can be specified further
by using vector_field_absolute
or vector_field_relative
.
There is also the image type int8
(64 bits with sign), which is
only available on 64 bit systems.
Further information on the different pixel types is given below.
- Gray Values
-
Gray images are of type
byte
(8 bits without sign) oruint2
(16 bits without sign) and consist of pixels usually representing local intensities of light on a sensor. - Difference
-
In order to show the differences between two images e.g., the image types
int1
(8 bits with sign) orint2
(16 bits with sign) are well suited.( 1) ( 2) ( 3) - 2D Histogram
-
To examine image features based on the occurrence of gray values in two images you can use a 2D histogram, which is of type
int4
(32 bits with sign). Thereby, the axes of the 2D histogram each represent the gray values of an input image. The gray values of corresponding pixels in the input images are registered in the 2D histogram accordingly. The higher the frequency of a specific combination of gray values, the higher the gray value in the output image (see also
).histo_2dim
( 1) ( 2) ( 3) - Edge Directions
-
To represent the orientation of the edge gradient, the image type
direction
(8 bits without sign) is available.( 1) ( 2) For images of type
direction
an edge direction of x degrees in mathematically positive sense and with respect to the horizontal axis is stored as x / 2 in the edge direction image (resulting in gray values from 0 to 179). Points with edge amplitude 0 are assigned the edge direction 255 (undefined direction). - Derivatives
-
The image type
real
(32 bits floating point value) is used to represent derivatives of an image, e.g., in order to extract edges.( 1) ( 2) - Fourier Transform
-
To inspect the frequency domain of an image the Fourier transform is used. The combination of magnitude and phase of the frequencies is represented by complex numbers, therefore the image type is
complex
(tworeal
values per pixel).( 1) ( 2) - Hue Values
-
Hue values are encoded
cyclic
(8 bits without sign) so that .( 1) ( 2) - Vector Field
-
A special image type to represent absolute/relative optical flow is
vector_field
(composed by tworeal
images for x and y direction). The type of vector field can be specified further by assigningvector_field_absolute
(interpreted as absolute coordinates) orvector_field_relative
(interpreted as vectors).( 1) ( 2) ( 3)
Channels
Besides different pixel types, an image can use different image channels in order to store specific information. Basically, you can use channels to assign multiple values to a pixel. The following sections mention a few cases, where different numbers of channels are useful.
- Gray Value Images (Single-Channel Images)
-
Often, there is only one value stored for every pixel of an image. A gray value image for example, stores a value representing local light intensity on a sensor for each pixel. Nevertheless, various types of information can be assigned to those pixels (e.g., the derivatives of gray values, distances). Visualizing them analogous to a gray value image can help interpreting the data.
- RGB Images (Three-Channel Images)
-
For a colored image, the pixel values are typically stored in three channels each representing the intensity of either red, green or blue light of the respective pixel (RGB image). Through additive mixing of the three values assigned to one pixel, a specific color is defined.
Besides the RGB model there are several further color spaces. For more information about those models and how to transform between the different color spaces see
andtrans_to_rgb
respectively.trans_from_rgb
( 1) ( 2) ( 3) ( 4) - Multispectral Images (Multi-Channel Images)
-
With special cameras, a variety of spectral bands can be registered in an image, including from outside the visible light spectrum. Satellite cameras, for instance, often acquire multispectral data and store them in multiple distinct channels respectively.
( 1) ( 2) ( 3) ( 4) ( 5) ( 6) - Multi-Channel Images
-
Besides representing light intensities, assembling multiple channels in one image can help with various other tasks.
For example, combining a gray value image with an additional channel containing the respective depth values of the image pixels allows you to visualize the scene in a 3D plot.
Instead of using a depth camera you can also use a multi-channel image to extract depth information. Therefore, each channel must contain one of a series of images taken with different focus levels.
Besides containing spacial information, the channels of an image can also be interpreted as a feature space in order to perform a principal components analysis.
Domain
The image domain determines the area of an image that is used in the succeeding operations. In order to focus the processing on regions of interest and/or speed up the operations you can reduce the domain to the relevant parts of an image.
( 1) | ( 2) | ( 3) |