F_VN_PolarizedImageGlareReduction

F_VN_PolarizedImageGlareReduction 1:

Reduces glare in a polarized image (taken by a camera with a special polarization sensor) by selecting a small intensity value across the four polarization angles for each pixel (see fIndex parameter). For more advanced evaluation, you can use DemosaicPolarizedImage to access all the individual polarization angles.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_PolarizedImageGlareReduction : HRESULT
VAR_INPUT
    ipPolarizedImage : ITcVnImage;
    ipDestImage      : Reference To ITcVnImage;
    eEncoding        : ETcVnPixelEncoding;
    fIndex           : REAL;
    hrPrev           : HRESULT;
END_VAR

 Inputs

Name

Type

Description

ipPolarizedImage

ITcVnImage

Polarized image (USINT or UINT)

ipDestImage

Reference To ITcVnImage

Returns the glare reduced image (An appropriate destination image will be created if required.)

eEncoding

ETcVnPixelEncoding

Select PE_NONE for Mono or PE_BAYER_XX for Bayer sensor

fIndex

REAL

The four polarization angles for each pixel are sorted by intensity. Select the index (in the range of [0, 3]) to use for the destination image. Fractions compute a weighted average of 2 neighboring indices. Recommended to try 0.0 first, as this leads to the maximum possible glare reduction (but might lose some details). Values greater than 1 are valid, but usually increase glare instead of reducing it.

hrPrev

HRESULT

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

 Return value

HRESULT

Further information

The F_VN_PolarizedImageGlareReduction function reduces glare and reflections in a polarized image that conforms to specific polarized image formats.

For each pixel, the intensities of the four polarization angles are sorted, and the intensity value for the result image is then determined using fIndex. A pixel is dimmed only if the intensities depend heavily on the polarization angle, that is, if there are significant differences in the intensity values. Non-polarized image areas have nearly the same intensity across all four angles and therefore remain largely unchanged.

For a more detailed analysis of the individual polarization angles, you can use the F_VN_DemosaicPolarizedImage function.

Parameter

Input image

The input image ipPolarizedImage must be a polarization image of the type USINT (8 bits) or UINT (16 bits).

Result image

The image with reduced brightness is returned via ipDestImage.

eEncoding

The parameter eEncoding, of type ETcVnPixelEncoding, specifies the sensor's pixel encoding. For a monochrome sensor, select TCVN_PE_NONE. For a color polarization sensor, the corresponding Bayer pattern must be passed as TCVN_PE_BAYER_XX.

Selection index

The four polarization angles are sorted by intensity for each pixel. The parameter fIndex, with the range 0.0-3.0, determines the intensity value used for the output image. If a decimal value is specified, a weighted average of the two adjacent indices or the sorted intensity values is calculated. It is recommended to start by using the setting 0.0, as this results in the maximum possible reduction in glare (although some details may be lost). For example, 0.5 calculates the average of the smallest and second-smallest intensity values. However, values greater than 1.0 generally increase the glare rather than reduce it.

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.59 or later

PC or CX (x64) with min. PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision