F_VN_Granulometry

F_VN_Granulometry 1:

Computes the granulometry of a textured image using morphological operations.

Syntax

Definition:

FUNCTION F_VN_Granulometry : HRESULT
VAR_INPUT
    ipImage          : ITcVnImage;
    ipIntensityDiffs : Reference To ITcVnContainer;
    eMorphType       : ETcVnMorphologicalOperator;
    nMinSize         : UDINT;
    nMaxSize         : UDINT;
    nStep            : UDINT;
    hrPrev           : HRESULT;
END_VAR

F_VN_Granulometry 2: Inputs

Name

Type

Description

ipImage

ITcVnImage

Source image (1 channel)

ipIntensityDiffs

Reference To ITcVnContainer

Returns the intensity differences between successive structuring element sizes (CTcVnContainer_Vector_LREAL), which can be used as features for texture description.

eMorphType

ETcVnMorphologicalOperator

Only opening or closing are supported.

nMinSize

UDINT

Min structuring element size (odd, >= 3)

nMaxSize

UDINT

Max structuring element size (>= nMinSize)

nStep

UDINT

Step, by which nMinSize is incremented until nMaxSize is exceeded (even, >= 2).

hrPrev

HRESULT

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

F_VN_Granulometry 3: Return value

HRESULT

Further information

The function F_VN_Granulometry calculates the granulometric properties of an image. These values provide an indication of the size distribution of different image areas.

Parameter

Image

The input image ipImage.

Features

The granulometric features are returned as a container via the reference ipIntensityDiffs.

Operator type

The type of morphological operator is defined via eMorphType as TCVN_MO_OPENING or as TCVN_MO_CLOSING.

Operator size

The size of the morphological operators is determined by the minimum nMinSize, the maximum nMaxSize and the step size nStep. The operators must have an odd size and the step size must be even.

Application

For example, the calculation of granulometric features with closing operators in the sizes three, seven and eleven looks like this:

hr := F_VN_Granulometry(
    ipImage             :=  ipImage,
    ipIntensityDiffs    :=  ipIntensityDiffs,
    eMorphType          :=  TCVN_MO_CLOSING,
    nMinSize            :=  3,
    nMaxSize            :=  11,
    nStep               :=  4,
    hrPrev              :=  hr);

Related functions

Required License

TC3 Vision Machine Learning

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.54 or later

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

Tc3_Vision