## Image

List of Sections ↓

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.

### 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) or `uint2` (16 bits without sign) and consist of pixels usually representing local intensities of light on a sensor.

Gray value image.
Difference

In order to show the differences between two images e.g., the image types `int1` (8 bits with sign) or `int2` (16 bits with sign) are well suited.

 (1) (2) (3)
Comparing an image (1) with another (e.g., consecutively taken) one (2) by subtracting the latter from the former results in a difference image (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)
Two channels ((1), (2)) of an exemplary image and their respective 2D histogram (3).
Edge Directions

To represent the orientation of the edge gradient, the image type `direction` (8 bits without sign) is available.

 (1) (2)
Examining an image (1) by visualizing the orientation of its image edges (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).