F_VN_ImageCenterOfMass
Computes the center of mass of an image.
Syntax
Definition:
FUNCTION F_VN_ImageCenterOfMass : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
END_VAR
VAR_IN_OUT
aCenterOfMass : TcVnPoint2_LREAL;
END_VAR
VAR_INPUT
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
Source image (1 channel) | |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
In/Outputs
Name |
Type |
Description |
---|---|---|
aCenterOfMass |
Returns the center of mass of the image |
Further information
This function calculates the center of mass of the input image. The expert version F_VN_ImageCenterOfMassExp exists with advanced parameterization options.
Parameter
Input image
The input image ipSrcImage
must be a 1-channel image. If you wish to calculate the center of mass of a multi-channel image, you have the following options:
- You can split the multi-channel image into individual channels using F_VN_SplitImageChannels and calculate a center of mass for each channel.
- You can convert the multi-channel image into a 1-channel image using F_VN_ConvertColorSpace and calculate a center of mass for it.
Center of mass (return value)
The calculated center of mass is returned via the reference aCenterOfMass
.
Required License
TC3 Vision Base
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 |