F_VN_AdaptiveThreshold

F_VN_AdaptiveThreshold 1:

Apply an adaptive threshold to a gray level image.
Can return partial results when canceled by Watchdog.

Syntax

Definition:

FUNCTION F_VN_AdaptiveThreshold : HRESULT
VAR_INPUT
    ipSrcImage  : ITcVnImage;
    ipDestImage : Reference To ITcVnImage;
    fMaxValue   : LREAL;
    hrPrev      : HRESULT;
END_VAR

F_VN_AdaptiveThreshold 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (1 channel, elements of type USINT)

ipDestImage

Reference To ITcVnImage

Destination image (An appropriate destination image will be created if required.)

fMaxValue

LREAL

Value assigned to pixels for which the threshold condition is true

hrPrev

HRESULT

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

F_VN_AdaptiveThreshold 3: Return value

HRESULT

Weiterführende Informationen

Die Funktion F_VN_AdaptiveThreshold wendet einen adaptiven Threshold auf das Eingangsbild an.

Parameter

Eingangsbild

Das Eingangsbild ipSrcImage muss ein 1-kanaliges Grauwertbild mit einer Bittiefe von 8 Bit (USINT) sein.

Ergebnisbild

Das binäre Ergebnisbild ipDestImage hat das gleiche Format wie das Eingangsbild. Die Pixel haben entweder den Wert 0 oder den Zielwert fMaxValue.

Zielwert

Der Zielwert fMaxValue definiert, welchen Wert die Pixel bekommen sollen, die das Schwellwert-Kriterium erfüllen. Wenn das Ergebnisbild nur aus schwarzen und weißen Pixeln bestehen soll, muss hier der Maximal-Wert des Element-Typs des Eingangsbilds eingestellt werden. Dies entspricht (2^d)-1, wobei d die Bittiefe des Element-Typs darstellt; z. B. (2^8)-1=255 bei 8-Bit-Bildern.

Expert-Parameter

Die Expert-Variante F_VN_AdaptiveThresholdExp enthält zusätzliche Parameter.

Anwendung

hr := F_VN_AdaptiveThreshold(
    ipSrcImage      :=  ipImageIn,
    ipDestImage     :=  ipImageRes,
    fMaxValue       :=  255, // max value of 8-bit image: (2^8)-1=255
    hrPrev          :=  hr
);

Verwandte Funktionen

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1. 4024.44 or later

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

Tc3_Vision