DemosaicPolarizedImage

Demosaics a polarized image (taken by a camera with a special polarization sensor) by separating it into four polarization angles (expected sensor layout: top left 90°, top right 45°, bottom left 135°, bottom right 0°).

Syntax

Definition:

HRESULT DemosaicPolarizedImage(
    HRESULT                          hrPrev,
    ITcVnImage*                      ipPolarizedImage,
    ITcVnImage*&                     ip0Deg,
    ITcVnImage*&                     ip45Deg,
    ITcVnImage*&                     ip90Deg,
    ITcVnImage*&                     ip135Deg,
    ETcVnPixelEncoding               eEncoding,
    ETcVnPolarizedImageInterpolation eInterpolation
)

Parameters

Name

Type

Description

hrPrev

HRESULT

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

ipPolarizedImage

ITcVnImage*

Polarized image (USINT or UINT)

ip0Deg

ITcVnImage*&

Returns the 0° component of the polarized image (Optional, set to 0 if not required. Must be different from ipPolarizedImage! An appropriate destination image will be created if required.)

ip45Deg

ITcVnImage*&

Returns the 45° component of the polarized image (Optional, set to 0 if not required. Must be different from ipPolarizedImage! An appropriate destination image will be created if required.)

ip90Deg

ITcVnImage*&

Returns the 90° component of the polarized image (Optional, set to 0 if not required. Must be different from ipPolarizedImage! An appropriate destination image will be created if required.)

ip135Deg

ITcVnImage*&

Returns the 135° component of the polarized image (Optional, set to 0 if not required. Must be different from ipPolarizedImage! An appropriate destination image will be created if required.)

eEncoding

ETcVnPixelEncoding

Select PE_NONE for Mono or PE_BAYER_XX for Bayer sensor

eInterpolation

ETcVnPolarizedImageInterpolation

Select PII_NONE to get the uninterpolated data, i.e. the ipXDeg result images only have the half width and height of ipPolarizedImage. The other options interpolate the data to the full resolution of ipPolarizedImage.

 Return value

HRESULT

Further information

The function F_VN_DemosaicPolarizedImage reconstructs, from the raw sensor image that conforms to specific polarization image formats, the four separate individual images corresponding to the polarization angles (0°, 45°, 90°, and 135°).

If the raw image contains color information, debayering can also be selected. The function expects the following filter layout for the four polarization directions: top left 90°, top right 45°, bottom left 135°, and bottom right 0°.

The four separate angular images form the basis for further analysis, such as the calculation of the polarization angle and degree of linear polarization using F_VN_AngleAndDegreeOfLinearPolarization.

Parameter

Input image

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

Result images for the polarization angles

The four output images ip0Deg, ip45Deg, ip90Deg, and ip135Deg return the separated image components for the respective polarization angles (0°, 45°, 90°, and 135°). If a particular angle is not needed, the corresponding parameter can be set to 0. The target images must be different from the input image ipPolarizedImage.

Pixel encoding

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.

Interpolation type

The parameter eInterpolation, of type ETcVnPolarizedImageInterpolation, determines how the separated angular images are interpolated or resolved. Since each polarization angle occupies only every other pixel in both the horizontal and vertical directions, the non-interpolated result images are only half the width and height of the input image.
The following options are available:

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4026 or later

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

Tc3_Vision