Modules | |
RLC Moments | |
Functions | |
void | rlc_feature (feature *f, U16 *rlc, I32 color) |
Calculate Compound Features in Unlabelled Run Length Code (RLC). More... | |
I32 | rl_ftr2 (U16 *rlc, ftr *f, U32 n) |
Calculate Object Features in the Labelled RLC. More... | |
I32 | rl_ftr3 (U16 *rlc, ftr *f, U32 n) |
Calculate Object Features in the Labelled RLC (Subpixel Version). More... | |
I32 | rlc_feret (U16 *src, F32 alpha, F32 *fer) |
Calculate Feret Diameters of all Objects in Labelled RLC. More... | |
I32 | rlc_minmax_feret (U16 *pRlc, I32 nsteps, F32 fMinAngleRad, F32 fMaxAngleRad, F32 *minferets, F32 *minangles, F32 *maxferets, F32 *maxangles) |
Calculate Minimum and Maximum Ferets for All Objects in Labelled RLC. More... | |
For a description see the section Features.
The function calculates features in the unlabelled RLC. The parameter color
can be used to specify if the features for all black (color = 0) or all white (color = 0xFFFF) pixels of the RLC should be calculated. All pixels of a given color (black or white) are included. There is no differentiation according to objects. The following features are calculated:
The maximum and minimum values of x and y define the bounding box around the pixels chosen with color
. rlc
is the start address of the run length code in memory. f
is a pointer to the feature list stored in the feature struct.
The function calculates object features of all objects in the labelled RLC. The following features are calculated:
The maximum and minimum values of x and y define the bounding box around the chosen object. The object pixels are guaranteed to be contiguous. The coordinates (x_lst, y_max) specify a point which can serve as the initial value for contour following. Please make sure, that the connectedness of the object labelling (e.g. sgmt()) corresponds to the contour following algorithm. rlc
is the start address of the labelled run length code in memory. f
is a pointer to the feature list, ftr as struct array, n
is the maximum number of objects, i.e. usually the dimension of the struct array. A pointer to the struct array is passed to this function. The pointer need not be initialized before you call this function. The struct array is provided with the correct features of all objects after the function is called.
The return value of the function is the number of objects in the labelled RLC.
ERR_SLC | if RLC is Unlabelled. |
ERR_RLC_ONOVR | if an Object Number Overrun occured. |
Object Count | on Success. |
The function calculates object features of all objects in the labelled RLC. The following features are calculated:
The maximum and minimum values of x and y define the bounding box around the chosen object. The object pixels are guaranteed to be contiguous. The coordinates (x_lst, y_max) specify a point which can serve as the initial value for contour following. Please make sure, that the connectedness of the object labelling (e.g. sgmt()) corresponds to the contour following algorithm.
In contrast to function rl_ftr2() which calculates the center of gravity only with pixel resolution, the function rl_ftr3() calculates it also in subpixel resolution and places the result in two additional variables in the data structure which are not used otherwise. rlc
is the start address of the labelled run length code in memory. f
is a pointer to the feature list (here: a struct array), n
is the maximum number of objects, i.e. usually the dimension of the struct array. The struct used has the following structure:
A pointer to the struct array is passed to this function. The pointer need not be initialized before you call this function. The struct array is provided with the correct features of all objects after the function is called.
The function returns the standard error code or, if no error occurred, the number of objects in the labelled RLC.
ERR_SLC | if RLC is Unlabelled. |
ERR_RLC_ONOVR | if Object Count exceeds n , or is Invalid. |
Object Count | Count of Objects in the Labelled RLC. |
The function calculates the feret diameter for all objects and the projection of all objects with respect to angle alpha
. The feret diameter is the size of the projection of the object into a certain angular direction, comparable to the measurement with a caliper held in that direction. For this purpose, the boundary of the object is projected into the direction alpha
. The feret diameters of all objects is output as an array of float values.
The float array for the result (pointer fer) must have a size of at least nobj elements. (nobj = number of objects in RLC/SLC)
src | Labelled Source RLC. |
alpha | The projection angle in rad [0..PI]. |
fer | The result array pointer (size = nobj elements). |
ERR_SLC | if RLC is unlabelled. |
ERR_RLC_ONOVR | if SLC object count is inappropriate. |
ERR_MEMORY | if internal feret list cannot be allocated. |
ERR_NONE | on success. |
I32 rlc_minmax_feret | ( | U16 * | pRlc, |
I32 | nsteps, | ||
float | fMinAngleRad, | ||
float | fMaxAngleRad, | ||
float * | minferets, | ||
float * | minangles, | ||
float * | maxferets, | ||
float * | maxangles | ||
) |
The function calculates the feret diameter for all objects. The feret diameter is the size of the projection of the object into a certain angular direction, comparable to the measurement with a caliper held in that direction. For this purpose, the boundary of the object is projected into the direction of nsteps
angles in the range of [fMinAngleRad
.. fMaxAngleRad
). The feret diameters of all objects are output as arrays of float values.
Unlike the function rlc_feret(), the function rlc_minmax_feret() calculates the minimum and maximum feret diameters for all objects. This is done by calling the function rlc_feret() nsteps
times and sweeping the projection angle starting at angle = fMinAngleRad
incresing angle from step to step by delta = (fMaxAngleRad
- fMinAngleRad
)/nsteps
.
In addition to the minimum and maximum diameters, the angles where the maximum and minimum were detected are also provided for earch object.
The float arrays for the result ferets and angles must have a size of at least nobj elements each. (nobj = number of objects in RLC/SLC)
All angles are in rad.
pRlc | Labelled Source RLC. |
nsteps | number of steps for feret calculation (angular resolution) |
fMinAngleRad | the minimum angle for the interation [rad]. |
fMaxAngleRad | the maximum angle for the interation [rad]. |
minferets | result array pointer for minimum feret or NULL. |
minangles | result array pointer for minimum angle or NULL. |
maxferets | result array pointer for maximum feret or NULL. |
maxangles | result array pointer for maximum angle or NULL. |
ERR_SLC | for unlabelled RLC. |
ERR_SLC_INCON | if SLC object count is inappropriate. |
ERR_PARAM | for fMinAngleRad >= fMaxAngleRad. |
ERR_PARAM | for fMinAngleRad < -PI. |
ERR_PARAM | for fMinAngleRad >= 2*PI. |
ERR_MEMORY | if out ou memory. |