VCLib Documentation  6.12.2

RLC (Run Length Code) Processing

RLC (Run Length Code) Processing

Functions

U16rlcmk (image *a, I32 thr, U16 *rlc, I32 size)
 Creates Run Length Code from Pixel Images. More...
 
U16rlcmk2 (image *src, I32 lowthr, I32 hithr, U16 *rlc, I32 size)
 Creates Run Length Code from Pixel Images Using 2 Thresholds. More...
 
U16rlcmkv (image *src, I32 thr, U16 *rlc, I32 size)
 Creates Vertical Run Length Code from Pixel Images. More...
 
U16rlcmkbit (image *a, I32 bit, U16 *rlc, I32 size)
 Creates Run Length Code of a Bitplane from a Pixel Image. More...
 
U16rlcmk_sub (image *a, image *b, I32 thr, U16 *rlc, I32 size)
 Subtract 2 Images and Create Run Length Code from Difference Image. More...
 
U16hysteresis_RLC (image *src, U16 *rlc, I32 size, I32 thr, I32 seed)
 Creates RLC Based on Canny Type Hysteresis Thresholding Binarization. More...
 
I32 rlcout (image *a, U16 *rlc, U32 dark, U32 bright)
 Outputs Run Length Code to a Pixel Image. More...
 
I32 rlcout_transparent (image *a, U16 *rlc, U8 plotBrightIff1, U8 color)
 Outputs Run Length Code to a Pixel Image (Transparent Mode). More...
 
I32 rlcout_pixellist (I32 *lstPx, I32 *lstPxCnt, I32 lstPxMaxCnt, U16 colIn, U16 *rlc)
 Outputs Run Length Code to a Pixel List. More...
 
I32 dispobj (image *a, U16 *rlc)
 Outputs Labelled Run Length Code with Objects in different Grey Values. More...
 
I32 rlc_mask_image (image *src, image *dst, U16 *rlc, I32 *objs, U8 color, I32 offsetX, I32 offsetY)
 Fills Regions of selected RLC Objects in Pixel Image with Color. More...
 
I32 vc_slc_out (image *img, U8 ch, U16 *rlc, U32 *lstColOfObj, I32 oneObjNrOrNegative, I32 oneObjCol, I32 oneObjColBg)
 Outputs SLC Object(s) to a channel of an image. More...
 
void vc_slc_print (U16 *rlc, U16 *slc, I32 indent)
 Prints out SLC Objects aligned to RLC. More...
 
void vc_slc_print_px (U16 *rlc, U16 *slc, I32 indent)
 Prints out SLC Objects Pixel by Pixel. More...
 
U16rlc2 (U16 *rlca, U16 *rlcb, U16 *dest, U16 *(*func)())
 Logically Linking of Two Images in Run Length Code (RLC). More...
 
U16rlc_inv (U16 *rlc)
 In-Place Inversion of RLC. More...
 
U16rlc_move (U16 *src, U16 *dst, I32 mx, I32 my)
 Translate RLC. More...
 
U16rlc_cutframe (U16 *src, U16 *dst, I32 dxDst, I32 dyDst, I32 mx, I32 my)
 Translate RLC and adjust image size to different RLC format. More...
 
U16rlc90 (U16 *src, U16 *dst, I32 size)
 Rotate Run Length Code by 90 Degrees. More...
 
U16rlc180 (U16 *src, U16 *dst)
 Rotate Run Length Code by 180 Degrees. More...
 
U16rlc_mirrorH (U16 *src, U16 *dst)
 Mirror RLC horizontally. More...
 
U16rlc_mirrorV (U16 *src, U16 *dst)
 Mirror RLC vertically. More...
 
I32 rlc_shear_x (U16 *src, U16 *dst, I32 shearDx)
 Shears Run Length Code in Horizontal Direction. More...
 
U16erxdi (U16 *src, U16 *dst, U16 *(*fc1)(), U16 *(*fc2)())
 Square shaped Erosion/Dilation of Run Length Code. More...
 
U16erxdi2 (U16 *src, U16 *dst, U16 *(*fc1)(), U16 *(*fc2)())
 Diamond shaped Erosion/Dilation of Run Length Code (RLC). More...
 
U16rlc_mf (U16 *src, U16 *dst, I32 col, I32 lng)
 Horizontal 'median filter' for RLC. More...
 
U32 rlc_area (U16 *rlc, I32 color)
 Count of Identically Coloured Pixels at Unlabelled Run Length Code (RLC). More...
 
U16fread_rlc (char *path, U16 *rlc)
 Reads (unlabelled) RLC from File. More...
 
I32 fwrite_rlc (char *path, U16 *rlc)
 Writes (unlabelled) RLC to File. More...
 
U16rlc_label_fast (U16 *rlc, U16 *rlcEnd, U16 *slc, I32 mode)
 Segment Run Length Code (Object Labelling) Sped up for Small Images. More...
 
U16rlc_label (U16 *rlc, U16 *slc, I32 mode)
 Segment Run Length Code (Object Labelling). More...
 
U16rlc_cut (U16 *src, U16 *dst, I32 objnum)
 Extract an Object out of the Labelled RLC. More...
 
I32 rl_area2 (U16 *rlc, U32 *area, U32 n)
 Calculate the Object Areas in the Labelled RLC. More...
 
I32 rlc_qin (U16 *rlc, I32 QIN[], U32 n)
 Object Inclusion Property for Labelled RLC. More...
 
I32 rlc_nhls (U16 *rlc, U32 holes[], U32 n)
 Number of Holes Property for Labelled RLC. More...
 
I32 rlc_arf (U16 *src, U16 *dst, U32 min_area)
 RLC Object Area Filter for Small Objects (works on labelled RLC). More...
 
I32 rlc_arf2 (U16 *src, U16 *dst, I32 col, U32 min_area, U32 max_area)
 RLC Object Area Filter using Minimum and Maximum Area.. More...
 
I32 rlc_select (U16 *rlc, U16 *rlc2, I32 selector[], U32 n, I32 mode)
 RLC Object Selection with Guide Image. More...
 
I32 rlc_select_by_polygon_simple (U16 *rlc, I32 *xyLst, U32 xyCnt, I32 *selector, U32 maxSelector)
 RLC Object Selection by Simple Polygon. More...
 
U16rlc_delete (U16 *src, U16 *dst, I32 keep[])
 Delete RLC Objects using a Selection List. More...
 
I32 rlc_getobject (U16 *rlc, I32 x, I32 y)
 RLC object number retrieval using image coordinates within an input RLC. More...
 
I32 rlc_keep_object (U16 *src, U16 *dst, I32 x, I32 y)
 RLC Extract an object from labelled RLC using x,y-coordinates. More...
 
U16rlcmk_seed (image *src, U16 *seed, U16 *rlc, I32 thresh, I32 size, I32 mode)
 Make RLC using seed RLC. More...
 
U16rlcmk_seed2 (image *src, U16 *seed, U16 *rlc, I32 thr1, I32 thr2, I32 size, I32 mode)
 Make RLC using seed RLC using a high and a low threshold. More...
 
U16rlcand_slc (U16 *rlca, U16 *slca, U16 *rlcb, U16 *rlcOut, U16 *slcOut, I32 *newObjNrOrNULL)
 Logically Anding of Two Images in Run Length Code, preserving SLC Objects. More...
 
U16rlc_zoom (U16 *src, U16 *dst, I32 magX, I32 magY)
 Zoom up RLC. More...
 
I32 rlc_rect (U16 *rlc, U16 rlcDx, U16 rlcDy, I32 rlcMaxBytes, U16 x0, U16 y0, U16 x1, U16 y1, U16 col)
 Generates a RLC image with a Rectangle at it. More...
 
U16rlc_drawline (U16 *rlc, U16 rlcDx, U16 rlcDy, float cx, float cy, float b, I32 col)
 Draws a Line in Normalized Floatingpoint Form into RLC. More...
 
U16rlc_drawlinesegment (U16 *rlc, U16 rlcDx, U16 rlcDy, I32 x0In, I32 y0In, I32 x1In, I32 y1In, I32 col)
 Draws a Line into RLC. More...
 
I32 rlc_draw_polygon (U16 *rlcOut, U16 rlcDx, U16 rlcDy, I32 *pi32PxLst, U32 u32CornerCount, I32 col)
 Draws a Polyline Contour. More...
 
I32 rlc_fill_polygons_simple (U16 *rlc, U16 rlcDx, U16 rlcDy, U32 rlcMaxBytes, U32 lstCnt, I32 *xyLst, U32 *xyCnt)
 
I32 rlc_objectaverage (image *src, U16 *rlc, U32 *average, U32 n)
 RLC feature: grey value average of RLC objects in image variable. More...
 
I32 rlc_objectmaxval (U32 *lstObjMaxVal, image *src, U8 ch, U16 *rlc, U16 *slcOrNULL)
 Gets Maximum Value of each SLC Object. More...
 
U16testrlc (U16 *rlc, I32 dx, I32 dy, I32 size)
 Generates a RLC Test Image (Chessboard). More...
 
I32 chkrlc (U16 *rlc)
 Checks for Errors in Labelled or Unlabelled RLC. More...
 
U16parse_rlc (U16 *rlc)
 Returns the Next Available Address by Parsing (unlabelled) RLC. More...
 
void vc_clc_print (U16 *rlc, U16 *clc, I32 indent)
 Prints out CLC aligned with RLC. More...
 
void vc_clc_print_px (U16 *rlc, U16 *clc, I32 indent)
 Prints out CLC Color Pixel by Pixel. More...
 
U16vc_clcmk (image *src, I32 thr, U16 *rlc, U16 *clc, U16 colCircularMax, U16 colBg, I32 fastModeIff1, I32 rlcMaxBytes)
 Color Run Length Code (CLC) generation. More...
 
U16vc_clc_label (U16 *rlc, U16 *rlcEnd, U16 *clc, U16 *slc, I32 mode)
 Segment Color Length Code (Object Labelling). More...
 
I32 vc_cyclic_colrange (U16 *colRangeLen, U16 *colRangeSt, U8 *wrapsIff1, U16 objRef, U16 *colOfObj, I32 colCircularMax, I32 colBg, U32 *eqv_tbl, U16 objCnt)
 Get Color Range over Equivalent Objects. More...
 
I32 vc_clc_merge_objs_by_colTol (U16 *rlcOut, U16 *clcOut, U16 *slcOut, U16 *rlc, U16 *clc, U16 *slc, I32 maxColTol, I32 mergedMaxColTol)
 Merge Objects of CLC by Color. More...
 
I32 vc_clc_remove_objs_by_area (U16 *rlcOut, U16 *clcOut, U16 *slcOut, U16 *rlc, U16 *clc, U16 *slc, I32 minArea)
 Remove Objects of CLC by Area. More...
 
I32 vc_clc_to_rgb (image *imgRgb, U16 *rlc, U16 *clc)
 Writes CLC Image Content to an RGB image. More...
 
I32 fwrite_image_clc (char *path, U16 *rlc, U16 *clc)
 Writes CLC Image Content to a Color Bitmap File (BMP). More...
 
I32 mask_polygon (image *psImgIn, image *psImgOut, U8 color, U32 u32CornerCount, I32 *pi32PxLst, U8 u8OutputSizeToSelectionIff1)
 Masks All but a Polygon Shaped Image Region. More...
 
U16rlc_fill (U16 *rlc, I32 dx, I32 dy, I32 color)
 Generates a Single Coloured RLC. More...
 
#define erode(a, b)   erxdi(a, b, (U16 *(*)())rlc_xero, (U16 *(*)())rlc_orf)
 Erodes Run Length encoded Images using a Square Shape. More...
 
#define dilate(a, b)   erxdi(a, b, (U16 *(*)())rlc_xdil, (U16 *(*)())rlc_andf)
 Dilates Run Length encoded Images using a Square Shape. More...
 
#define erode2(a, b)   erxdi2(a, b, (U16 *(*)())rlc_xero, (U16 *(*)())rlc_orf)
 Erodes Run Length encoded Images using a Diamond Shape. More...
 
#define dilate2(a, b)   erxdi2(a, b, (U16 *(*)())rlc_xdil, (U16 *(*)())rlc_andf)
 Dilates Run Length encoded Images using a Diamond Shape. More...
 
#define rlcand(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_andf )
 Pixelwise AND of Two RLC Images (Macro). More...
 
#define rlcor(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_orf )
 Pixelwise OR of Two RLC Images (Macro). More...
 
#define rlcxor(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_xorf )
 Pixelwise XOR of Two RLC Images (Macro). More...
 
#define rlcnand(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_nandf )
 Pixelwise NAND of Two RLC Images (Macro). More...
 
#define rlcnor(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_norf )
 Pixelwise NOR of Two RLC Images (Macro). More...
 
#define rlcequiv(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_equivf )
 Pixelwise Equivalence Test Value of Two RLC Images (Macro). More...
 
#define rlcandnot(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_andnotf)
 Pixelwise AND NOT of Two RLC Images (Macro). More...
 
#define rlcornot(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_ornotf)
 Pixelwise OR NOT of Two RLC Images (Macro). More...
 
#define rlcnandnot(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_nandnotf)
 Pixelwise NAND NOT of Two RLC Images (Macro). More...
 
#define rlcnornot(a, b, c)   rlc2(a, b, c, (U16 * (*)())rlc_nornotf)
 Pixelwise NOR NOT of Two RLC Images (Macro). More...
 
#define rlc_copy(src, dst)   rlc_move(src, dst, 0, 0)
 Copies RLC Code. More...
 
#define label44(rlc, slc)   rlc_label(rlc, slc, 0) /* white: 4-connected, black: 4-connected */
 4/4-Type Segment Run Length Code (Object Labelling) (Macro). More...
 
#define label88(rlc, slc)   rlc_label(rlc, slc, 1) /* white: 8-connected, black: 8-connected */
 8/8-Type Segment Run Length Code (Object Labelling) (Macro). More...
 
#define label84(rlc, slc)   rlc_label(rlc, slc, 2) /* white: 8-connected, black: 4-connected */
 8/4-Type Segment Run Length Code (Object Labelling) (Macro). More...
 
#define label48(rlc, slc)   rlc_label(rlc, slc, 3) /* white: 4-connected, black: 8-connected */
 4/8-Type Segment Run Length Code (Object Labelling) (Macro). More...
 

Detailed Description

Functions in this group operate on run length encoded image data, for example functions doing erosion/dilation, blob generation, feature extraction and more.

Note
For a description of the RLC format of the (U16*) rlc refer to Run Length encoded Images (RLC). For a description of the SLC format of the (U16*) slc refer to Segment Label Code (SLC).

Macro Definition Documentation

◆ rlcand

#define rlcand (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_andf )

The pixelwise logical AND value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcand() is a macro which calls rlc2() with basic function rlc_andf() as an argument.

◆ rlcor

#define rlcor (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_orf )

The pixelwise logical OR value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcor() is a macro which calls rlc2() with basic function rlc_orf() as an argument.

◆ rlcxor

#define rlcxor (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_xorf )

The pixelwise logical XOR value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcxor() is a macro which calls rlc2() with basic function rlc_xorf() as an argument.

◆ rlcnand

#define rlcnand (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_nandf )

The pixelwise logical NAND value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcnand() is a macro which calls rlc2() with basic function rlc_nandf() as an argument.

◆ rlcnor

#define rlcnor (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_norf )

The pixelwise logical NOR value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcnor() is a macro which calls rlc2() with basic function rlc_norf() as an argument.

◆ rlcequiv

#define rlcequiv (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_equivf )

The pixelwise logical equivalence test value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcequiv() is a macro which calls rlc2() with basic function rlc_equivf() as an argument.

◆ rlcandnot

#define rlcandnot (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_andnotf)

The pixelwise logical AND NOT value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcandnot() is a macro which calls rlc2() with basic function rlc_andnotf() as an argument.

◆ rlcornot

#define rlcornot (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_ornotf)

The pixelwise logical OR NOT value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcornot() is a macro which calls rlc2() with basic function rlc_ornotf() as an argument.

◆ rlcnandnot

#define rlcnandnot (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_nandnotf)

The pixelwise logical NAND NOT value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcnandnot() is a macro which calls rlc2() with basic function rlc_nandnotf() as an argument.

◆ rlcnornot

#define rlcnornot (   a,
  b,
 
)    rlc2(a, b, c, (U16 * (*)())rlc_nornotf)

The pixelwise logical NOR NOT value of the two RLC images a and b is written to RLC image dest.

dest must be different from a and b.

rlcnornot() is a macro which calls rlc2() with basic function rlc_nornotf() as an argument.

◆ erode

#define erode (   a,
 
)    erxdi(a, b, (U16 *(*)())rlc_xero, (U16 *(*)())rlc_orf)

The macro erodes the image by one pixel using a square shape. Erosion means that all white areas in the RLC become one pixel wider in each direction, while all black areas are narrowed one pixel.

erode() is a macro which calls erxdi() with basic functions rlc_xero() and rlc_orf() as arguments.

See the documentation of the called function for further information.

◆ dilate

#define dilate (   a,
 
)    erxdi(a, b, (U16 *(*)())rlc_xdil, (U16 *(*)())rlc_andf)

The macro dilates the image by one pixel using a square shape. Dilation means that all black areas in the RLC become one pixel wider in each direction, while all white areas are narrowed one pixel.

dilate() is a macro which calls erxdi() with basic functions rlc_xdil() and rlc_andf() as arguments.

See the documentation of the called function for further information.

◆ erode2

#define erode2 (   a,
 
)    erxdi2(a, b, (U16 *(*)())rlc_xero, (U16 *(*)())rlc_orf)

The macro erodes the image by one pixel using a diamond shape. Erosion means that all white areas in the RLC become one pixel wider in each direction, while all black areas are narrowed one pixel.

erode2() is a macro which calls erxdi2() with basic functions rlc_xero() and rlc_orf() as arguments.

See the documentation of the called function for further information.

◆ dilate2

#define dilate2 (   a,
 
)    erxdi2(a, b, (U16 *(*)())rlc_xdil, (U16 *(*)())rlc_andf)

The macro dilates the image by one pixel using a diamond shape. Dilation means that all black areas in the RLC become one pixel wider in each direction, while all white areas are narrowed one pixel.

dilate2() is a macro which calls erxdi2() with basic functions rlc_xdil() and rlc_andf() as arguments.

See the documentation of the called function for further information.

◆ label44

#define label44 (   rlc,
  slc 
)    rlc_label(rlc, slc, 0) /* white: 4-connected, black: 4-connected */

Segments the run length encoded image in rlc using the 4/4-connectedness model: White and black pixels connect to one object horizontally, vertically but not diagonally, Further information can be found at the main function rlc_label().

label44() is a macro which calls rlc_label() with mode=0 as an argument.

◆ label88

#define label88 (   rlc,
  slc 
)    rlc_label(rlc, slc, 1) /* white: 8-connected, black: 8-connected */

Segments the run length encoded image in rlc using the 8/8-connectedness model: White and black pixels connect to one object horizontally, vertically and diagonally, Further information can be found at the main function rlc_label().

label88() is a macro which calls rlc_label() with mode=1 as an argument.

◆ label84

#define label84 (   rlc,
  slc 
)    rlc_label(rlc, slc, 2) /* white: 8-connected, black: 4-connected */

Segments the run length encoded image in rlc using the 8/4-connectedness model: White pixels connect to one object horizontally, vertically and diagonally, Black pixels connect to one object horizontally, vertically but not diagonally. Further information can be found at the main function rlc_label().

label84() is a macro which calls rlc_label() with mode=2 as an argument.

◆ label48

#define label48 (   rlc,
  slc 
)    rlc_label(rlc, slc, 3) /* white: 4-connected, black: 8-connected */

Segments the run length encoded image in rlc using the 4/8-connectedness model: White pixels connect to one object horizontally, vertically but not diagonally, Black pixels connect to one object horizontally, vertically and diagonally. Further information can be found at the main function rlc_label().

label48() is a macro which calls rlc_label() with mode=3 as an argument.

◆ rlc_copy

#define rlc_copy (   src,
  dst 
)    rlc_move(src, dst, 0, 0)

The macro copies RLC code. The destination RLC must have been allocated.

rlc_copy() is a macro which calls rlc_zoom().

Function Documentation

◆ rlcmk()

U16* rlcmk ( image a,
I32  thr,
U16 rlc,
I32  size 
)

The function creates run length code (RLC) for the image variable a and stores it in memory. thr is the threshold value used for binarization, 0 ≤ thr < 256. A pixel with a gray scale gthr is interpreted as white, otherwise as black. rlc is the starting address at which the RLC is stored in memory, size is the number of words in memory available for the RLC. If there is not enough space here, creation of the RLC is aborted and the function returns NULL.

This function returns a pointer (U16 *) to the next memory address which is not yet written with RLC Data. The pointer is aligned to the next integer address. In case of error, the function returns NULL.

Parameters
aInput Image.
thrBinarization Threshold.
rlcPointer to RLC memory to be written by the function.
sizeMaximum Size (in Bytes) allowed for Code.
Returns
Pointer past End of Output RLC (Aligned).
Memory Consumption
None.
See also
rlcout()
rlcmk2()

◆ rlcmk2()

U16* rlcmk2 ( image src,
I32  lowthr,
I32  hithr,
U16 rlc,
I32  size 
)

The function creates run length code (RLC) for the image variable a and stores it in memory. lowthr and hithr are the low and high binarization thresholds, 0 ≤ lowthr < hithr ≤ 256. A pixel with a gray scale in between the 2 thresholds is interpreted as white, otherwise as black. Precisely, a pixel value belonging to the set [lowthr, hithr) is considered white. rlc is the starting address at which the RLC is stored in memory, size is the number of words in memory available for the RLC. If there is not enough space here, creation of the RLC is aborted and the function returns NULL.

This function returns a pointer (U16 *) to the next memory address which is not yet written with RLC Data. The pointer is aligned to the next integer address. In case of error, the function returns NULL.

if lowthrhithr, the function returns NULL

Parameters
srcInput Image.
lowthrLow Binarization Threshold.
hithrHigh Binarization Threshold.
rlcPointer to Memory to be written by Function.
sizeMaximum Size (in Bytes) allowed for Code.
Returns
Pointer past End of Output RLC (Aligned).
Memory Consumption
None.
See also
rlcout().

◆ rlcmkv()

U16* rlcmkv ( image src,
I32  thr,
U16 rlc,
I32  size 
)

This function generates vertical run length code from a given image. src->dx must be > 6 for highspeed RLC routine.

Parameters
srcSource Image.
thrBinarization Threshold.
rlcPointer to RLC to be Written by Function.
sizeMaximum Byte Count allowed for rlc.
Memory Consumption
(2 * src->dx * src->dy + 10 * src->dx + 8) Bytes of Heap Memory.
Return values
NULLif src->dx < 6.
NULLif size is too low.
NULLif Memory Allocation Fails.
AddressPointer Past End of Output RLC (Aligned).

◆ rlcmkbit()

U16* rlcmkbit ( image a,
I32  bit,
U16 rlc,
I32  size 
)

The function creates run length code for the image variable a and stores it in memory. bit indicates the bitplane for which the run length code is created. It should be a power of two. A pixel with the corresponding bit being set (pixel & bit ≠ 0) is interpreted as white, otherwise as black. rlc is the starting address at which the RLC is stored in memory, size is the number of words in memory available for the RLC. If there is not enough space here, creation of the RLC is aborted and the function returns NULL. This function returns a pointer (U16 *) to the next memory address which is not yet written with RLC. The pointer is aligned to the next integer address. In case of error, it returns NULL.

Parameters
aInput Image.
bitBit Value for Bitplane Comparison 1 if White.
rlcPointer to RLC to be Written by Function.
sizeMaximum Size (in Bytes) Allowed for Code.
Memory Consumption
None.
See also
rlcmk(), rlcout().
Return values
NULLif size is too low.
AddressPointer past end of output RLC (aligned).

◆ rlcmk_sub()

U16* rlcmk_sub ( image a,
image b,
I32  thr,
U16 rlc,
I32  size 
)

The function first subtracts 2 images using Absolute Difference (function FL_sub2f). The run length code (RLC) for the difference image is created and stored in memory. thr is the threshold value used for binarization, 0 ≤ thr < 256. A pixel with a gray scale gthr is interpreted as white, otherwise as black. rlc is the starting address at which the RLC is stored in memory, size is the number of words in memory available for the RLC. If there is not enough space here, creation of the RLC is aborted and the function returns NULL.

This function returns a pointer (U16 *) to the next memory address which is not yet written with RLC Data. The pointer is aligned to the next integer address. In case of error, the function returns NULL.

Parameters
a,bInput Images.
thrBinarization Threshold.
rlcPointer to RLC memory to be written by the function.
sizeMaximum Size (in Bytes) allowed for Code.
Returns
Pointer past End of Output RLC (Aligned).
Memory Consumption
None.
See also
rlcmk()
rlcmk2()
rlcout()

◆ hysteresis_RLC()

U16* hysteresis_RLC ( image src,
U16 rlc,
I32  rlclength,
I32  thr,
I32  seed 
)

This function performs a Canny type hysteresis thresholding. The seed threshold is used to generate seed points which are then used to select connected areas of the threshold thr which qualify for output. The selection is done using the function rlc_select() to select objects in a selection table. All other objects that are not selected are deleted from the low-threshold-RLC afterwards using the function rlc_delete(). If seed is higher than thr, the function does Canny-type hyteresis thresholding for bright objects with even brighter seed points. If seed is lower than thr, the function switches to thresholding for dark objects with even darker seed points.

Parameters
srcSource Image.
rlcRLC Output.
rlclengthMaximum Count of Words for rlc.
thrObject Threshold used for Object Based Extension.
seedSeed Threshold.
Returns
Pointer to the Next Available RLC Location.

◆ rlcout()

I32 rlcout ( image a,
U16 rlc,
U32  dark,
U32  bright 
)

The function converts a run length code image into a gray image. This is mostly used to display the run length code on the screen. However, this function can also be used to prepare for image processing operations which are not possible directly at the run length code, or which would be difficult in it. The image variable a provides the start address and the pitch for the output. The function immediately aborts with error code ERR_FORMAT if the image format (dx, dy) implicitly contained in the run length code does not agree with a->dx and a->dy of the image variable. rlc is the start address of the run length code in memory, dark is the gray scale for the black areas of the RLC, bright is the gray scale for the white areas - here, values between 0 and 255 are possible.

Parameters
aInput Image.
rlcPointer to RLC (Labelled or Unlabelled).
darkPixel value for RLC Color "0".
brightPixel value for RLC Color "-1".
Memory Consumption
None.
See also
rlcmk().
Return values
ERR_FORMATif RLC (dx, dy) differs from output image (dx, dy).
ERR_NONEon Success.

◆ rlcout_transparent()

I32 rlcout_transparent ( image a,
U16 rlc,
U8  plotBrightIff1,
U8  color 
)

The function converts a run length code image into a gray image. Contrary to the function rlcout(), the function rlcout_transparent() only plots bright or dark parts of the image as selected by plotBrightIff1 and leaves the rest transparent. Please make sure to initialize the input image a appropriately before calling the function. The function can be used to display the run length code on the screen or writing it to the overlay. This function can also be used to prepare for image processing operations which are not possible directly at the run length code, or which would be difficult in it. If used in this way, rlc provides a mask for the regions where rlcout_transparent() sets the pixels of image to a constant value (color).

The image variable a provides the start address and the pitch for the output. The function immediately aborts with error code ERR_FORMAT if the image format (dx, dy) implicitly contained in the run length code does not agree with a->dx and a->dy of the image variable. rlc is the start address of the run length code in memory, color is the grey value drawn at the regions selected by the parameter plotBrightIff1.

Parameters
aInput Image.
rlcPointer to RLC (Labelled or Unlabelled).
plotBrightIff1nothing is plotted at dark regions if 1, and vice versa.
colorpixel value for the color to plot
Memory Consumption
None.
See also
rlcout(), rlcmk().
Return values
ERR_FORMATif RLC (dx, dy) differs from output image (dx, dy).
ERR_NONEon Success.

◆ rlcout_pixellist()

I32 rlcout_pixellist ( I32 lstPx,
I32 lstPxCnt,
I32  lstPxMaxCnt,
U16  colIn,
U16 rlc 
)

The function converts a run length code image into a pixellist. lstPx has 2 * lstPxMaxCnt I32 values, i.e. x[i] = lstPx[2*i+0] and y[i] = lstPx[2*i+1].

Parameters
lstPxOutput Pixel List (preallocated).
lstPxCntPixel List elements written.
lstPxMaxCntMaximum allowed Pixel List elements.
colInpixel coordinates of this color are added to list.
rlcPointer to RLC (Labelled or Unlabelled).
Return values
ERR_OVERRUNif lstPxMaxCnt is exceeded.
Memory Consumption
None.
See also
rlcout(), rlcmk().

◆ dispobj()

I32 dispobj ( image a,
U16 rlc 
)

The function serves to output the labelled RLC for test purposes. The various objects contained in the labelled RLC are drawn with different gray scales. Otherwise, the output is basically equivalent to the function rlcout().

Parameters
aDestination Pixel Image.
rlcLabelled Source RLC.
Memory Consumption
None.
Return values
ERR_FORMATif RLC is Unlabelled.
ERR_FORMATif Object Number Overruns.
ERR_FORMATif Input RLC dx/y differs from Output Image dx/y.
ERR_NONEon Success.

◆ rlc_mask_image()

I32 rlc_mask_image ( image src,
image dst,
U16 rlc,
I32 objs,
U8  color,
I32  offsetX,
I32  offsetY 
)

The function fills the dst image grey value of all objects selected by objs with the constant value color. All other pixel values remain unchanged. It is possible to add offsetX and offsetY to the coordinates of the destination image which results in a movement of the image. Pixels out of the scope of the original image will also be filled with color. The purpose of the function is the selection of the grey values only for a number of objects for which features need to be calculated e.g. the mean grey value of the object pixels. The content of the source image moves left (or up) in the destination image with raising offsetX (or offsetY).

rlc_mask_image.png
Parameters
srcThe Source Image of Type IMAGE_GREY.
dstThe Destination Image (may be equal to src).
rlcThe Segmented Run Length Code.
colorThe Fill Color.
objsPoints to Object Selection List; Object Number is Array Index, a Value of 0 means "Object Unselected" i.e., the Grey Value is Unchanged.
offsetX,offsetYsrc Coordinate of the Top-Left Point in dst Image.
Memory Consumption
None.
Return values
ERR_PARAMif (RLC is not segmented) or (src.type != IMAGE_GREY) or (dst.type != IMAGE_GREY) or (src.dx != rlc dx) or (src.dy != rlc dy) or (offsetX not in [0, src->dx-1]) or (offsety not in [0, src->dy-1])
ERR_NONEon Success.

◆ vc_slc_out()

I32 vc_slc_out ( image img,
U8  ch,
U16 rlc,
U32 lstColOfObj,
I32  oneObjNrOrNegative,
I32  oneObjCol,
I32  oneObjColBg 
)

This function outputs regions of SLC objects to a channel of an image.

Parameters
imgThe Output image.
chThe Output image channel to be written to.
rlcThe labelled RLC
lstColOfObjAn array with grey values used for and assigned over each object nr, may be NULL for a varying color based on the object number (not necessarily unique), unused if oneObjNrOrNegative is >= 0.
oneObjNrOrNegative,oneObjCol,oneObjColBggive a single object number for setting the values to either oneObjCol or oneObjColBg, or to use the lstColOfObj.
Return values
ERR_TYPEif src is of unknown type or unsupported
ERR_PARAMif ch exceeds image src components.

◆ vc_slc_print()

void vc_slc_print ( U16 rlc,
U16 slc,
I32  indent 
)

This function prints out SLC object numbers parallel to its RLC positions for debugging.

Parameters
rlcThe RLC of the SLC
slcThe SLC to be used
indentLeft indentation used for printing.

◆ vc_slc_print_px()

void vc_slc_print_px ( U16 rlc,
U16 slc,
I32  indent 
)

This function prints out SLC object numbers per Pixel, so it is only meaningful for debugging small images.

Parameters
rlcThe RLC of the SLC
slcThe SLC to be used
indentLeft indentation used for printing.

◆ rlc2()

U16* rlc2 ( U16 rlca,
U16 rlcb,
U16 dest,
U16 *(*)()  func 
)

The function makes it possible to calculate any operations between two run length codes. rlca and rlcb pass the memory address of both RLCs. The memory address of the resulting RLC is passed by dest. dest must be different from rlca and rlcb. The RLCs to be linked must have the identical format (dx, dy). If this is not the case, then the function returns NULL. Otherwise, the function rlc2() returns the next not yet written memory address for the resulting RLC dest (integer aligned).

For execution, it does not matter if the RLC is labelled or unlabelled. In both cases, the result is an unlabelled RLC. A pointer to the basic function to be executed specifies the nature of the operation. The following macros use this function:

Operation Call Basic function
AND rlcand(a, b, dest) rlc_andf()
OR rlcor(a, b, dest) rlc_orf()
XOR rlcxor(a, b, dest) rlc_xorf()
NAND rlcnand(a, b, dest) rlc_nandf()
NOR rlcnor(a, b, dest) rlc_norf()
EQUIV rlcequiv(a, b, dest) rlc_equivf()
AND_NOT rlcandnot(a, b, dest) rlc_andnotf()
OR_NOT rlcornot(a, b, dest) rlc_ornotf()
NAND_NOT rlcnandnot(a, b, dest)rlc_nandnotf()
NOR_NOT rlcnornot(a, b, dest) rlc_nornotf()

Of course, you can write your own basic functions. Pass them as function pointer to rlc2().

Parameters
rlcaFirst RLC Source.
rlcbSecond RLC Source.
destRLC Output.
funcRLC Basic Function Pointer (Performs the Actual Operation).
Memory Consumption
None.
Return values
NULLif rlca and rlcb have different formats.
AddressPointer past end of output RLC (aligned).

◆ rlc_inv()

U16* rlc_inv ( U16 rlc)

The function performs the in-place inversion of RLC stored at address rlc in memory (interpretable as logical NOT).

Inversion means, that black segments are changed to white and vice versa. The inversion is obtained by negating the color information at the start of each line. rlc_inv() returns the address of the next item to follow the RLC code (integer aligned).

Parameters
rlcSource and Destination RLC.
Memory Consumption
None.
Return values
AddressPointer Past End of Output RLC (Aligned).

◆ rlc_move()

U16* rlc_move ( U16 src,
U16 dst,
I32  mx,
I32  my 
)

The function reads RLC line at memory address src, moves all RLC items horizontally by mx pixels (mx negative: move left), vertically by my lines (my negative: move up) and outputs the result to dest. src and dest must be different for this operation. Black space (color=0) is added for the regions outside the original window.

Parameters
srcPointer to Source RLC.
dstPointer to Destination RLC.
mxx Coordinate of Movement Vector.
myy Coordinate of Movement Vector.
Memory Consumption
None.
Return values
AddressPointer Past End of Output RLC (Aligned).

◆ rlc_cutframe()

U16* rlc_cutframe ( U16 src,
U16 dst,
I32  dxDst,
I32  dyDst,
I32  mx,
I32  my 
)

The function reads RLC line at memory address src, moves all RLC items horizontally by mx pixels (mx negative: move left), vertically by my lines (my negative: move up) and outputs the result to dest. src and dest must be different for this operation. Black space (color=0) is added for the regions outside the original window.

Parameters
srcPointer to Source RLC.
dstPointer to Destination RLC.
dxDstHorizontal size for destination RLC.
dyDstVertical size for destination RLC.
mxx Coordinate of Movement Vector.
myy Coordinate of Movement Vector.
Memory Consumption
None.

◆ rlc90()

U16* rlc90 ( U16 src,
U16 dst,
I32  size 
)
Parameters
srcSource RLC Pointer.
dstDestination RLC Pointer.
sizeMaximum Count of Bytes Allowed for dst.
Memory Consumption
(2* dx * dy + 6 * dx + 2) Bytes of Heap Memory.
Return values
AddressPointer past end of output RLC (aligned).

◆ rlc180()

U16* rlc180 ( U16 src,
U16 dst 
)
Parameters
srcSource RLC Pointer.
dstDestination RLC Pointer.
Memory Consumption
(5* dy) Bytes of Heap Memory.
Return values
AddressPointer past end of output RLC (aligned).

◆ rlc_mirrorH()

U16* rlc_mirrorH ( U16 src,
U16 dst 
)

do not use in-place

Parameters
srcSource RLC Pointer.
dstDestination RLC Pointer.
Memory Consumption
(5* dy) Bytes of Heap Memory.
Return values
AddressPointer past end of output RLC (aligned).

◆ rlc_mirrorV()

U16* rlc_mirrorV ( U16 src,
U16 dst 
)

do not use in-place

Parameters
srcSource RLC Pointer.
dstDestination RLC Pointer.
Memory Consumption
(5* dy) Bytes of Heap Memory.
Return values
AddressPointer past end of output RLC (aligned).

◆ rlc_shear_x()

I32 rlc_shear_x ( U16 src,
U16 dst,
I32  shearDx 
)

This function shears RLC in horizontal direction. Due to the pixel quantization, there may be approximations in the positioning: If the Bresenham Algorithm has due to the shearing factor more than one possible position for one row, the center position will be used, eventually floored against 0. Also formerly connected area parts may disconnect through this operation.

rlc_shear_x.png

Be sure to have correct colors at the border of the source RLC, since the border values will be the fill color for out-of-image regions!

Parameters
srcSource RLC Pointer.
dstDestination RLC Pointer, allocated size >= src.
shearDxHorizontal Pixel Deviation between uppermost and lowermost RLC Line (approx.).

◆ erxdi()

U16* erxdi ( U16 src,
U16 dst,
U16 *(*)()  fc1,
U16 *(*)()  fc2 
)
rlc_erxdi.png

The function erodes/dilates the image by one pixel. Erosion means that all white areas in the RLC become one pixel wider in each direction, while all black areas are narrowed one pixel. Thus, black areas which are 1 or 2 pixels in diameter disappear completely. src is a pointer to the source RLC, dest to the destination RLC. The function pointers passed specify the type of operation being performed. fc1 is the function pointer for the horizontal erosion/dilation process, fc2 is the function pointer for the vertical erosion/dilation process. The following macros call this function:

Operation Call Basic function fc1() Basic function fc2()
Erosion erode(a, b) rlc_xero() rlc_orf()
Dilation dilate(a, b) rlc_xdil() rlc_andf()

Of course, you can write your own horizontal and vertical functions. Pass them as function pointers to erxdi().

Parameters
srcPoints to Source RLC.
dstPoints to Destination RLC.
fc1Points to Function to do the Horizontal Processing.
fc2Points to Function to do the Vertical Processing.
Memory Consumption
8*(dx+1) Bytes of Heap Memory.
See also
erxdi2().
rlc_mf(), mx(), mn().
Return values
AddressPointer past End of Output RLC (Aligned).

◆ erxdi2()

U16* erxdi2 ( U16 src,
U16 dst,
U16 *(*)()  fc1,
U16 *(*)()  fc2 
)
rlc_erxdi.png

The function erodes/dilates the image by one pixel. It is most similar to the erxdi2() function, but instead of a square as structuring element, it uses a diagonal (diamond-shaped) structuring element. The influence of the structuring element becomes apparent, if the function is called several times on the data of the previos erosion/dilation. A round shaped structuring element can be approximated by alternating the calls of erxdi() and erxdi2(), this procedure will produce an octagonal shaped structuring element which is much closer to a circle. src is the source RLC, dest is the destination RLC. The function pointers passed specify the type of operation being performed. fc1 is the function pointer for the horizontal erosion/dilation, fc2 is the function pointer for the vertical erosion/dilation.

The following macros call this function:

Operation Call Basic function fc1() Basic function fc1()
Erosion erode2(a, b) rlc_xero() rlc_orf()
Dilation dilate2(a, b) rlc_xdil() rlc_andf()

Of course, you can write your own horizontal and vertical functions. Pass them as function pointers to erxdi2().

Parameters
srcPoints to Source RLC.
dstPoints to Destination RLC.
fc1Points to Function to do the Horizontal Processing.
fc2Points to Function to do the Vertical Processing.
Memory Consumption
4*(dx+1) Bytes of Heap Memory.
See also
erxdi().
rlc_mf(), mx(), mn().
Return values
AddressPointer past End of Output RLC (Aligned).

◆ rlc_mf()

U16* rlc_mf ( U16 src,
U16 dst,
I32  col,
I32  lng 
)
rlc_mf.png

The function performs a horizontal median filtering on run length encoded images.

The median filter purges all structures of color col with length less than lng. The operation will create less data at address dest than the original RLC at address src. Moreover, the operation may be performed in-place, i.e. src and dest may be the same. The function is valuable to reduce the amount of useless information in noisy images in an early stage of RLC processing. The function returns a pointer to the next available memory word (U16) to follow the RLC code (integer aligned).

Parameters
srcPointer to Source RLC.
dstPointer to Destination RLC.
colColor of Median Purge.
lngHorizontal Width of Median.
Memory Consumption
None.
See also
erxdi(), erxdi2(), mx(), mn().
Return values
AddressPointer Past End of Output RLC (Aligned).

◆ rlc_area()

U32 rlc_area ( U16 rlc,
I32  color 
)
rlc_area.png

The function calculates the area of all pixels of a given color (black: color = 0, white: color = 0xFFFF) in the unlabelled RLC. All pixels of a given color (black or white) are included. There is no differentiation according to objects. rlc is the start address of the run length code in memory. The return value of this function is the area.

See also
rlc_feature(), rl_area2().
Memory Consumption
none.
Return values
AreaBlack or White Pixel Count in RLC.

◆ fread_rlc()

U16* fread_rlc ( char *  path,
U16 rlc 
)

The function opens a file and reads the RLC of this file to memory at address rlc. The full path of the file is specified by the string path. The function returns a pointer to the next available memory word to follow the RLC code (integer aligned).

Parameters
pathFull File Path to Input File.
rlcAllocated Destination RLC.
Memory Consumption
None.
See also
fwrite_rlc().
Return values
AddressPointer Past End of Output RLC (Aligned).
NULLif File Reading Fails.

◆ fwrite_rlc()

I32 fwrite_rlc ( char *  path,
U16 rlc 
)

The function creates a file and writes the RLC starting at address rlc to this file. The full path of the file is specified by the string path. If the function is unable to open the specified file, it returns ERR_OPEN, otherwise ERR_NONE.

Parameters
pathFull File Path to Output File.
rlcSource RLC.
Memory Consumption
None.
See also
fread_rlc().
Return values
ERR_NONEon Success.
ERR_OPENif File Opening Fails.

◆ rlc_label_fast()

U16* rlc_label_fast ( U16 rlc,
U16 rlcEnd,
U16 slc,
I32  mode 
)

This function is the same as rlc_label() but with an extra argument for the end of the rlc. This allows to get a speed up at least at small enough images.

Refer to the documentation of rlc_label().

Parameters
rlcPointer to Unlabelled RLC.
rlcEndPointer to the memory after the content of the rlc, available as return value of most rlc functions.
slcPointer to SLC (Object Labels) Output.
modeConnectivity mode:
  • 0: 4/4 (Standard)
  • 1: 8/8
  • 2: 8/4
  • 3: 4/8
Return values
NULLon Licence Error.
NULLif Memory Allocation Fails.
AddressPointer Past End of Output SLC (Aligned).
NULLif an Object Overrun occurs.

◆ rlc_label()

U16* rlc_label ( U16 rlc,
U16 slc,
I32  mode 
)

One of the most important functions for binary images (RLC) is object labelling. Object labelling or connected component labelling means that all connected areas within an image are being clustered together and assigned a unique identifier, the object number. The function labels the run length code stored starting at the memory address rlc. The function will output the object labelling information at memory address slc which must be specified. Enough memory must be available for the memory needs of the SLC (The SLC needs (size_of_rlc - 4) bytes of memory). mode indicates a certain neighborhood connectedness for the segmentation according to the following table:

mode Connectedness Macro Library
0 4/4 (standard) sgmt(rlc, slc), label44(rlc, slc) VCLıb
1 8/8 label88(rlc, slc) ExtLıb
2 8/4 label84(rlc, slc) ExtLıb
3 4/8 label48(rlc, slc) ExtLıb

A connectedness of 8/4 means that the white pixels must be 8-connected and the black pixels must be 4-connected to form an object.

image_slc.png
Note
Please note that since functions like rlc_qin() might produce nonsensical results when called with RLC data of different connectedness, we recommend using the standard 4/4 connectedness model (macro sgmt(rlc, slc)).

The slc pointer is stored in the run length code at address rlc and rlc+1. This indicates a labelled RLC. The number of objects found and the object numbers for the individual RLC segments are stored in the SLC. The object numbers begin at 0; a total of 32000 object numbers are allowed. An 'object number overrun' occurs if this number is exceeded.

The return value of this function is the next free memory address (integer aligned). The function returns NULL in case of an error. This might be an object number overrun in which case the number of objects field in the SLC is also set to zero.

Parameters
rlcPointer to Unlabelled RLC.
slcPointer to SLC (Object Labels) Output.
modeConnectivity mode:
  • 0: 4/4 (Standard)
  • 1: 8/8
  • 2: 8/4
  • 3: 4/8
Memory Consumption
256 kB of Heap Memory (= 8 * 32000).

◆ rlc_cut()

U16* rlc_cut ( U16 src,
U16 dst,
I32  objnum 
)
rlc_cut.png

The function copies individual connected pixel areas (objects) out of the labelled RLC. src is the labelled source RLC, dst is the unlabelled target RLC. objnum is the number of the object to be copied. All objects copied out (including black ones) are stored white on a black background in the target RLC regardless of their original color. The return value of this function is the address of the next available memory space immediately after the target RLC. The function is aborted and NULL is returned if src is unlabelled or if objnum is larger than the number of objects contained in the RLC.

Parameters
srcSource RLC.
dstDestination RLC.
objnumObject Number.
Memory Consumption
None.
Return values
NULLif RLC is Unlabelled.
NULLif SLC Object Number is Invalid.
AddressPointer Past End of Output RLC (Aligned).

◆ rl_area2()

I32 rl_area2 ( U16 rlc,
U32 area,
U32  n 
)
rlc_area.png

The function calculates the area of all objects in the labelled RLC. rlc is the start address of the labelled RLC in memory. area is an array for the object areas, and n is the maximum number of objects, i.e. usually the dimension of the array. After the function rl_area2() is called, the object areas for all objects (independent of their colors) are available in the array area. The function returns the number of objects in the labelled RLC.

Parameters
rlcSource RLC.
areaComputed Areas as Array.
nMaximum Number of Array Entries allowed.
Memory Consumption
None.
See also
rlc_area().
Return values
ERR_SLCif RLC is Unlabelled.
ERR_RLC_ONOVRif Object Number overruns.
Object CountNumber of Objects in SLC.

◆ rlc_qin()

I32 rlc_qin ( U16 rlc,
I32  QIN[],
U32  n 
)
rlc_qin.png

The function computes the object inclusion property for all objects. It is calculated, which object is contained by which other object. This topological relationship is stored in the array qin[].

If an object touches more than one image boundary, this property cannot be computed for this object. In this case, qin is set to -1 for this object.

Note
Please note that this function might produce nonsensical results when called with RLC data of connectedness other than the standard 4/4 connectedness model (macro sgmt(rlc, slc)).
Parameters
rlcRLC pointer
QINarray for QIN values for each object (output) object inclusion relationship -1 indicates that this object touches more than 1 image boundaries. example: QIN[2] = 1 means object 2 is inside object 1
nsize of QIN[]
Memory Consumption
4*nobj*sizeof(int) Bytes of Heap Memory.
See also
rlc_nhls().
Return values
ERR_SLCif RLC is Unlabelled.
ERR_RLC_ONOVRif an Object Number Overrun occured.
ERR_SLC_INCONif SLC object count is inappropriate.
ERR_RLC_MEMif Memory Allocation Failed.
Object Counton Success.

◆ rlc_nhls()

I32 rlc_nhls ( U16 rlc,
U32  holes[],
U32  n 
)
rlc_nhls.png

The function computes the number of holes for all objects in labelled RLC. Please be aware that even very small objects with a few pixels are counted as holes. It is therefore recommended to clean the image with the function rlc_arf() first.

Parameters
rlcRLC Pointer.
holesArray for the Number of Holes for Each Object (Output).
nSize of holes[] Array.
Memory Consumption
(4*nobj+ n)*sizeof(int) Bytes of Heap Memory.
See also
rlc_qin().
Return values
ERR_RLC_MEMif Memory Allocation Fails.
ERR_SLCif RLC is Unlabelled.
ERR_RLC_ONOVRif an Object Number Overrun occured.
ERR_SLC_INCONif SLC object count is inappropriate.
ERR_RLC_MEMif Memory Allocation Failed.
Object Counton Success.

◆ rlc_arf()

I32 rlc_arf ( U16 src,
U16 dst,
U32  min_area 
)
rlc_arf.png

The function deletes all objects of the source RLC with an area less than min_area. This can be used to drastically reduce the amount of RLC entries and to speed up the following routines operating on RLC. The function is intended to eliminate small objects.

Note, that the output RLC is unlabelled. It might therefore be necessary to call sgmt() again for object labelling. The function returns the number of objects on success or the (negative) standard error code on error.

Parameters
srcLabelled source RLC.
dstDestination RLC (unlabelled).
min_areaObjects smaller than min_area will be deleted.
Memory Consumption
nobj*sizeof(int) bytes of heap memory.
See also
rlc_mf(), rlc_delete(), rlc_arf2().
Return values
ERR_SLCif RLC is unlabelled.
ERR_SLC_INCONif SLC object count is inappropriate.
ERR_RLC_MEMif Memory Allocation Fails.
Object CountCount of Objects in original source RLC.

◆ rlc_arf2()

I32 rlc_arf2 ( U16 src,
U16 dst,
I32  col,
U32  min_area,
U32  max_area 
)
rlc_arf.png

The function deletes all objects of the source RLC with an area less than min_area and larger than max_area. With col it is possible to select the color for the objects to be deleted. With col != (0, -1), any color is selected for deletion.

The function calls rlc_delete(). Please mind that any restriction for rlc_delete() also applies to rlc_arf2()

Note, that the output RLC is unlabelled. It might therefore be necessary to call sgmt() again for object labelling. The function returns the number of objects on success or the (negative) standard error code on error.

Parameters
srcLabelled source RLC.
dstDestination RLC (unlabelled).
colColor of objects to be deleted, 0 = black, -1 = white, any other value: any color
min_areaObjects smaller than min_area will be deleted.
max_areaObjects larger than max_area will be deleted.
Memory Consumption
nobj*sizeof(int) bytes of heap memory.
See also
rlc_mf(), rlc_delete(), rlc_arf().
Return values
ERR_SLCif RLC is unlabelled.
ERR_SLC_INCONif SLC object count is inappropriate.
ERR_RLC_MEMif Memory Allocation Fails.
ERR_RLC_MEMif Memory Allocation Fails.
Object CountCount of Objects in original source RLC.

◆ rlc_select()

I32 rlc_select ( U16 rlc,
U16 rlc2,
I32  selector[],
U32  n,
I32  mode 
)
rlc_select.png

The function is used for the selection of objects in a binary image given by rlc. A second binary image rlc2 is used as a guide image to specify where objects in the first image are selected. Together with the function rlc_delete(), this functionality is sometimes called 'morphological reconstruction'. The function generates an array selector, which is 1 for each object selected and 0 otherwise The format of both RLCs (i.e. the size of the image in x and y) must be identical, otherwise the function returns with ERR_RLCFMT.

Parameters
rlcPoints to Labelled RLC.
rlc2Points to (Unlabelled) "Selector" RLC.
selectorOutput Array with Selection Information for All Objects.
nSize of selector[], must be >= Number of Objects in the Input RLC.
modeSelection Mode, Reference for the selection is always rlc2, e.g. in mode=2 all objects in rlc would be selected where the rlc2-(selector) pixels are black, all others are deselected.
  • 0, Standard Mode: Select White Objects.
  • 1: Select White (and All Black) Objects.
  • 2: Select Black Objects.
  • 3: Select Black (and all White) Objects.
Memory Consumption
None.
See also
rlc_delete(), rlc_arf().
Return values
ERR_SLCif RLC is Unlabelled.
ERR_RLC_ONOVRif Object Count is 0, or overruns n.
ERR_SLC_INCONif SLC object count is inappropriate.
ERR_RLCFMTif RLC dx/y differs from Selector RLC dx/y.
Object NumberNumber of Objects.

◆ rlc_select_by_polygon_simple()

I32 rlc_select_by_polygon_simple ( U16 rlc,
I32 xyLst,
U32  xyCnt,
I32 selector,
U32  maxSelector 
)

The function is used for the selection of objects in a binary image given by rlc. A interior simple polygon is used as a guide to specify where objects in the image are selected: Everything but the background selects the underlying objects. The function generates an array selector, which is 1 for each object selected and 0 otherwise.

Note
For proper functioning, reassure that all polygon coordinates lie at the image.
Parameters
rlcPoints to Labelled RLC.
selectorOutput Array with Selection Information for All Objects, Size of selector[], must be at least the Number of Objects in the Input RLC.
maxSelectorSelector array size.
See also
rlc_select().
Return values
ERR_SLCif RLC is Unlabelled.
ERR_OVERRUNif Selector array is too small.
ERR_MEMORYif allocation fails.
ERR_PARAMif polygon generation fails.

◆ rlc_delete()

U16* rlc_delete ( U16 src,
U16 dst,
I32  keep[] 
)
rlc_delete.png

The function deletes objects from an RLC using a selection list. The source RLC must be labelled, whereas the result RLC is unlabelled. Some restrictions apply for the usage: (1) Deleting only one object and keeping all others works fine (2) Deleting strictly objects of one color works fine (3) Deleting objects without holes (internal objects) works fine (4) Deleting smaller objects and keeping larger ones works fine The term "smaller" may be in the sense of "less pixels" or "smaller width" or "smaller height" or any diameter or projection in any direction (5) Deleting ANY objects with ANY color without the above restrictions may lead to inconsistent or unexpected behavior. Unexpected dst RLCs may be produced. It is at the user's responsibility to make sure that one of the above conditions is met. The function does NOT check for it.

Parameters
srcaource RLC.
dstdestination RLC.
keepselection Array == 0: delete, != 0 : keep.
Memory Consumption
None.
See also
rlc_select(), rlc_arf(), rlc_arf2().
Return values
NULLif RLC is unlabelled.
NULLif SLC object count is inappropriate.
AddressPointer to the next available RLC.

◆ rlc_getobject()

I32 rlc_getobject ( U16 rlc,
I32  x,
I32  y 
)

The function is used for the selection of objects in a binary image given by rlc. A coordinate pair (x, y) defines the position where an object in the image should be selected. Together with the function rlc_delete(), this functionality is sometimes called 'morphological reconstruction'. The function returns the (positive) objectnumber of the selected object or a (negative) error code.

Parameters
rlcPoints to Labelled RLC.
x,yCoordinates of Selection Point.
Return values
objectObject Number (output).
Memory Consumption
None.
See also
rlc_select(), rlc_delete().
Return values
ERR_SLCif RLC is Unlabelled.
ERR_RLC_ONOVRif Object Count is 0.
ERR_SLC_INCONif SLC object count is inappropriate.
ERR_PARAMif (x, y) not within image.
Object Number.

◆ rlc_keep_object()

I32 rlc_keep_object ( U16 src,
U16 dst,
I32  x,
I32  y 
)

The function is used for the extraction of objects in a binary image given by rlc. A coordinate pair (x, y) defines the position where an object in the image should be extracted. This is sometimes called 'morphological reconstruction' of an object. The extracted object is always white on dark background. rlc_keep_object() internally calls function rlc_getobject() first to get the object number of the relevant object. It then extracts the object from the RLC using function rlc_cut(). The function returns the (positive) objectnumber of the selected object or a (negative) error code.

Function can be called in-place i.e. src and dst can be pointers to the same address.

Parameters
srcPointer to labelled source RLC.
dstPointer to unlabelled destination RLC (output).
x,yCoordinates of Selection Point.
Return values
objectObject Number (output).
Memory Consumption
None.
See also
rlc_select(), rlc_getobject(), rlc_cut().

◆ rlcmk_seed()

U16* rlcmk_seed ( image src,
U16 seed,
U16 rlc,
I32  thresh,
I32  size,
I32  mode 
)

function outputs RLC for all objects overlapping the seed RLC

Parameters
srcsource image
seedseed RLC, only objects that overlap seed will survive
rlcdestination RLC
threshthreshold for binarization
sizemaximum size of output RLC
modethe seed mode (see select())
             0:   standard mode: select white objects
             1:   select white (and all black) objects
             2:   select black objects
             3:   select black (and all white) objects
Return values
pointerto next available RLC address, error: NULL

◆ rlcmk_seed2()

U16* rlcmk_seed2 ( image src,
U16 seed,
U16 rlc,
I32  thr1,
I32  thr2,
I32  size,
I32  mode 
)

function outputs RLC for all objects overlapping the seed RLC select pixels between thr1 = lo, thr2 = 150 = high

Parameters
srcsource image
seedseed RLC, only objects that overlap seed will survive
rlcdestination RLC
thr1,thr2high and low thresholds for binarization
sizemaximum size of output RLC
modethe seed mode (see select())
             0:   standard mode: select white objects
             1:   select white (and all black) objects
             2:   select black objects
             3:   select black (and all white) objects
Return values
pointerto next available RLC address, error: NULL

◆ rlcand_slc()

U16* rlcand_slc ( U16 rlca,
U16 slca,
U16 rlcb,
U16 rlcOut,
U16 slcOut,
I32 newObjNrOrNULL 
)

The function makes it possible to calculate a logical AND operation between two run length codes by preserving the object numbers of the first RLC source rlca. The second RLC, rlcb, is used as guide image, where

  • rlcb white regions get the underlying rlca object number, and
  • rlcb black regions get the maximum object number, which increases then by 1.

rlcOut must be different from rlca and rlcb. The RLCs to be linked must have the identical format (dx, dy). If this is not the case, then the function returns NULL. Otherwise, the function returns the next not yet written memory address for the resulting RLC dest (integer aligned).

Parameters
rlcaFirst RLC Source.
slcaFirst SLC Source or NULL to use the implicit pointer at rlca.
rlcbSecond RLC Source (white keep objects, black writes new objNr).
rlcOutRLC Output.
slcOutSLC Output.
newObjNrOrNULLIf set to NULL, the output slc has the same object numbers as the input slc, that means, that there may be object numbers not present anymore; if you set it to an array of objNr size, there will be a renumbering reducing the object number; the new count is stored at the slcOut, and the rlcb black region object gets the number (new count-1); the array can be used to look up the new number by using the old object number as index.
Memory Consumption
None.
Return values
NULLif rlca and rlcb have different formats.
AddressPointer past end of output RLC (aligned).

◆ rlc_zoom()

U16* rlc_zoom ( U16 src,
U16 dst,
I32  magX,
I32  magY 
)

The function reads RLC line at memory address src, enlarges all RLC items horizontally by factor magX, vertically by magY lines and outputs the result to dest. The function can be used in-place, i.e. src and dst can be identical;

Negative magX or will zoom down.

Parameters
srcPointer to Source RLC.
dstPointer to Destination RLC.
magXZoom factor x.
magYZoom factor y.
Memory Consumption
None.
Return values
AddressPointer Past End of Output RLC (Aligned).

◆ rlc_fill()

U16 * rlc_fill ( U16 rlc,
I32  dx,
I32  dy,
I32  color 
)

The function creates an empty test image RLC format using just one color.

Parameters
rlcRLC Test Image Output.
dxx Size of RLC.
dyy Size of RLC.
colorFill color.
Return values
AddressPointer past End of Output RLC (Aligned).
AddressPointer past End of Output RLC (Aligned).

◆ rlc_rect()

I32 rlc_rect ( U16 rlc,
U16  rlcDx,
U16  rlcDy,
I32  rlcMaxBytes,
U16  x0,
U16  y0,
U16  x1,
U16  y1,
U16  col 
)

This function generates a RLC image with a rectangle at it.

Return values
-1x0, x1, y0, y1, out of range rlcDx, rlcDy.
-2rlcMaxBytes is too low, needs more memory.
Parameters
rlcPre-Allocated Source RLC Pointer.
rlcMaxBytesAllocated Bytes for the RLC Pointer.
x0,y0,x1,y1Diagonal Rectangle Points, both part of the rectangle.
colColor of the Rectangle, Background is inverse.

◆ rlc_drawline()

U16* rlc_drawline ( U16 rlc,
U16  rlcDx,
U16  rlcDy,
float  cx,
float  cy,
float  b,
I32  col 
)

This function draws a Bresenham line in normalized floatingpoint form into a new RLC image with size (rlcDx, rlcDy). The line is defined as: $ cx * x + cy *y - b = 0$. If the line does not intersect the RLC image, the function outputs an empty RLC.

Memory requirement for RLC: sizeof(U16) * (4 + 4*(max(rlcDx,rlcDy) + 1)) at maximum.

The function returns a pointer to the next valid address behind the RLC.

Parameters
rlcPre-allocated source RLC pointer (see text).
rlcDx,rlcDyDimensions of the RLC generated.
cx,cy,bParameters of the line to be drawn.
colColor of the line, background is inverse.
See also
rlc_drawlinesegment().

◆ rlc_drawlinesegment()

U16* rlc_drawlinesegment ( U16 rlc,
U16  rlcDx,
U16  rlcDy,
I32  x0In,
I32  y0In,
I32  x1In,
I32  y1In,
I32  col 
)

This function draws a Bresenham line from coordinate (x0In, y0In) to (x1In, y1In) into a new RLC image with size (rlcDx, rlcDy). If the line does not intersect the RLC image, the function outputs an empty RLC.

Memory requirement for RLC: sizeof(U16) * (4 + 4*(max(rlcDx,rlcDy) + 1)) at maximum.

The function returns a pointer to the next valid address behind the RLC.

Parameters
rlcPre-allocated source RLC pointer (see text).
rlcDx,rlcDyDimensions of the RLC generated.
x0In,y0In,x1In,y1InEnd points of the line to be drawn.
colColor of the line, background is inverse.
See also
rlc_drawline().
Return values
rlcpointer to next available RLC address (integer aligned).

◆ rlc_draw_polygon()

I32 rlc_draw_polygon ( U16 rlcOut,
U16  rlcDx,
U16  rlcDy,
I32 pi32PxLst,
U32  u32CornerCount,
I32  col 
)

The function draws a polyline in the image pointed by psImgOut. The line can be drawn normally, or as XOR in the gray image or using dotted or other styles.

The drawing stops at the boundary of the image variable.

The nature of drawing is specified by passing the pointer (* func)() to the drawing function itself. The following macros use this function: draw_polylined(), draw_polylinex().

Parameters
psImgOutPointer to Image Variable.
u32CornerCountCorner Count of the Polyline.
pi32PxLstList of u32CornerCount Point Coordinates as Pixel List [I32 P1x, I32 P1y, I32 P2x, ...].
colContour Color.
funcDrawing Function, eg. dashed_U8().
Return values
ERR_MEMORYif allocation fails.
1if a corner lies outside of the image.

◆ rlc_fill_polygons_simple()

I32 rlc_fill_polygons_simple ( U16 rlc,
U16  rlcDx,
U16  rlcDy,
U32  rlcMaxBytes,
U32  lstCnt,
I32 xyLst,
U32 xyCnt 
)
Return values
ERR_MEMORYif allocation fails.
ERR_PARAMif polygon generation fails.
positiveif polygon exceeds image.

◆ rlc_objectaverage()

I32 rlc_objectaverage ( image src,
U16 rlc,
U32 average,
U32  n 
)

The function works on labelled RLC and calculates the average grey value for each object using the original grey image. The image variable src provides the data for the averaging. The function immediately aborts with error code ERR_FORMAT if the image format (dx, dy) implicitly contained in the run length code does not agree with a->dx and a->dy of the image variable. It returns with ERR_OVERRUN if there is not enough space to store the result in the array average. On success the function returns the (positive) number of objects.

Return values
nobjNo Error.
ERR_FORMATFormat Error.
ERR_OVERRUNtoo many objects for size of output array
Parameters
srcInput Image.
rlcPointer to RLC (must be labelled).
averageresult array
nnumber of array elements for average
Memory Consumption
4*nobj bytes

◆ rlc_objectmaxval()

I32 rlc_objectmaxval ( U32 lstObjMaxVal,
image src,
U8  ch,
U16 rlc,
U16 slcOrNULL 
)

The function returns the maximum value of a given channel ch as list over the SLC objects.

Parameters
lstObjMaxValoutput, points to pre-allocated array with SLC object number entries.
srcPointer to Source Image containing the values.
chChannel of Source Image used for obtaining the pixel value.
rlcLabelled Run lenght code for object reference.
slcOrNULLIf set to NULL, the SLC reference at the rlc data is used.
Memory Consumption
None.
Return values
ERR_TYPEif src is of unknown type or unsupported
ERR_PARAMif ch exceeds image src components.
ERR_OVERRUNif src dx/dy is smaller than rlc dx/dy
ERR_SLCif rlc is unlabelled.
ERR_NONEon success.

◆ testrlc()

U16* testrlc ( U16 rlc,
I32  dx,
I32  dy,
I32  size 
)

The function creates a test image in RLC format. rlc is the start address of the RLC, where the test image is written to. dx and dy is the horizontal and vertical size of the image. size is the size of the individual chess-board squares in pixel. dy must be a multiple of size, it will be rounded off otherwise. The function returns a pointer to the next available memory word (U16) to follow the RLC code (integer aligned). The function can be used to test functionality and execution timing of RLC functions including object labelling. A test image of size 640×480 with a chess-board square size of 32 pixels needs 10084 words (U16) of RLC, which is a good approximation of the average information amount of a 'real life' image of that format.

Parameters
rlcRLC Test Image Output.
dxx Size of RLC.
dyy Size of RLC.
sizeSize of individual Chessboard Tiles.
Memory Consumption
4*(dx+1) Bytes of Heap Memory.
Return values
AddressPointer past End of Output RLC (Aligned).

◆ chkrlc()

I32 chkrlc ( U16 rlc)

Problems usually occur with functions which use run length code if the RLC contains errors. For example, even the function rlcout(), which outputs the RLC on the screen, may crash if called with faulty RLC. The functions in the library have been checked for correctness, so problems are not to be expected. If the user, however, develops an own function for RLC processing, it is recommended to check the RLC during the development process. The function chkrlc() may be used for this purpose. The function should not be used for the final program, since - it was not optimized for speed - it outputs debug information via the serial communication link In particular, this function checks the following:

  • labelled or unlabelled RLC for labelled RLC the SLC address and the number of objects are printed.
  • dx and dy are printed.
  • negative RLC values.
  • nonincreasing, i.e., constant or decreasing RLC values per line.
  • RLC values greater than dx.

For labelled RLC, the following is also checked:

  • two identical sequential SLC values.
  • SLC values greater than the maximum number of objects.

In case of error, the function returns -1, otherwise 0.

Debug information is printed during execution.

Parameters
rlcPoints to RLC.
Return values
-1if RLC is not Consistent.
ERR_NONEon Success.

◆ parse_rlc()

U16* parse_rlc ( U16 rlc)

The function parses the (unlabelled) RLC specified by pointer rlc and returns the next available memory address (integer aligned) right behind the RLC. Be careful: If the RLC is labelled, please make sure to write NULL to the SLC pointer contained in the RLC before writing to the result address of this function.

Memory Consumption
None.
Return values
AddressPointer Past End of Output RLC (Aligned).

◆ vc_clc_print()

void vc_clc_print ( U16 rlc,
U16 clc,
I32  indent 
)

This function prints out CLC information parallel to its RLC positions for debugging.

Parameters
rlcThe RLC of the CLC
clcThe CLC to be used
indentLeft indentation used for printing.

◆ vc_clc_print_px()

void vc_clc_print_px ( U16 rlc,
U16 clc,
I32  indent 
)

This function prints out CLC color per Pixel, so it is only meaningful for debugging small images.

Parameters
rlcThe RLC of the CLC
clcThe CLC to be used
indentLeft indentation used for printing.

◆ vc_clcmk()

U16* vc_clcmk ( image src,
I32  thr,
U16 rlc,
U16 clc,
U16  colCircularMax,
U16  colBg,
I32  fastModeIff1,
I32  rlcMaxBytes 
)

This function generates a so-called color run length code (CLC) from an image. It consists of two outputs:

  • the (compatible) RLC at rlc which stores the positions where colors change; color interpretation of the RLC value (0xFFFF as white and 0 as black) becomes senseless,
  • the CLC at clc containing
    • either the color value of the color input source src->ccmp1 where values of the guide input source src->st equals or exceeds the threshold thr,
    • or the special color value, colBg, for values lower than the threshold thr, called ´background´.

An example usage is the input of a vector image from the gradient_3x3_thresh() function, using the magnitude (st) as guide input and the direction (ccmp1) as color. The threshold selects the strong enough edges, and their direction is stored as color at the CLC clc. Regions with magnitudes lower than the threshold get the value colBg at the CLC.

Note
Color run length code is only a good choice if the segmentation of the image depends on an additional information, like 'same brightness but different color'
Returns
pointer past last written rlc entry or NULL on error.
Parameters
srcinput image data of type IMAGE_VECTOR (st: threshold check, ccmp1: color)
rlcResult Pointer to Unlabelled RLC Output.
clcResult Pointer to CLC Output.
colBgCLC value for magnitude < thr, for example 0xFFFF.
fastModeIff1In this mode the src input image's ccmp1 channel must already contain the thresholded magnitude information by having assigned colBg at those pixels (set colBg appropriate!), where the magnitude at the st channel is smaller than the threshold thr; information at st is ignored.
rlcMaxBytesAllocated size of rlc and clc.
Return values
NULLif src is not of IMAGE_VECTOR
NULLon ERR_MEMORY wrt. rlcMaxBytes

◆ vc_clc_label()

U16* vc_clc_label ( U16 rlc,
U16 rlcEnd,
U16 clc,
U16 slc,
I32  mode 
)
Parameters
rlcPointer to Unlabelled RLC.
rlcEndPointer to first position after Unlabelled RLC (returned by most RLC functions, for example vc_clcmk()).
clcPointer to CLC.
slcPointer to SLC (Object Labels) Output.
modeConnectivity mode:
  • 0: 4/4 (Standard)
Return values
NULLif allocation fails.
NULLif there are too much objects.
Return values
NULLon Licence Error.
NULLif Memory Allocation Fails.
AddressPointer Past End of Output SLC (Aligned).
NULLif an Object Overrun occurs.

◆ vc_cyclic_colrange()

I32 vc_cyclic_colrange ( U16 colRangeLen,
U16 colRangeSt,
U8 wrapsIff1,
U16  objRef,
U16 colOfObj,
I32  colCircularMax,
I32  colBg,
U32 eqv_tbl,
U16  objCnt 
)

This function gets the color range from objects where eqv_tbl[objRef] == eqv_tbl[obj]. The colors are at the colOfObj table (not over eqv_tbl, so for example colOfObj[objRef]). colCircularMax is the end value, for example 256 or 128 where the color wraps. colRangeLen is then the result value of the 'color angle' and colRangeSt the first color; wrapsIff1 is set to 1 if the circular maximum is overstepped by the range, e.g. 126 127 0 1 2 -> range 4, st 126, wraps

Parameters
colRangeLen,colRangeSt,wrapsIff1Color Range output.
objRef,eqv_tblReference ObjectNr for testing equality over eqv_tbl with each object: eqv_tbl[objRef] == eqv_tbl[obj]
colOfObjColor of each object, referenced over the object number.
colCircularMaxMaximum color not part of the color cycle anymore.
colBgIf color of object is this color, it is ignored for the range acquisition: 'background color'.
objCntNumber of objects.

◆ vc_clc_merge_objs_by_colTol()

I32 vc_clc_merge_objs_by_colTol ( U16 rlcOut,
U16 clcOut,
U16 slcOut,
U16 rlc,
U16 clc,
U16 slc,
I32  maxColTol,
I32  mergedMaxColTol 
)

This function merges objects of the labelled CLC if their color is nearly similar. This similarity test is local, meaning, objects with color 1,2,3 are merged to one object also if the maxColTol is set to 1. If mergedMaxColTol > 0, the total area of the objects with colors to be merged is tested against it, and if is out of range, the color of the merged object is set to colBg.

Parameters
rlcOut,clcOut,slcOutResult output.
rlc,clc,slcInput RLC/CLC/SLC.
maxColTolMaximum local color tolerance to be merged.
mergedMaxColTolIf greater than zero and area oversteps, the background color of the CLC is assigned to the merged object.

◆ vc_clc_remove_objs_by_area()

I32 vc_clc_remove_objs_by_area ( U16 rlcOut,
U16 clcOut,
U16 slcOut,
U16 rlc,
U16 clc,
U16 slc,
I32  minArea 
)

This function melds all objects smaller than the given area with a random neighbour which must be greater than the area; so if there is not even one neighbour of such kind, the smaller area object is still present afterwards.

Parameters
rlcOut,clcOut,slcOutResult output.
rlc,clc,slcInput RLC/CLC/SLC.
minAreaMinimum area to be kept.

◆ vc_clc_to_rgb()

I32 vc_clc_to_rgb ( image imgRgb,
U16 rlc,
U16 clc 
)

This function writes the CLC image defined by image variable rlc and clc to a RGB image. The color represents its clc value by going from its minimum clc value to its maximum: Red -> Orange -> Yellow -> Green -> Cyan -> Blue -> Violet -> Pink. The pixel is turned black if a background pixel is detected (colBg=*(clc+3)).

Parameters
imgRgbThe preallocated Destination Image.
rlc,clcSource Image Pointer.
Memory Consumption
None.
See also
fwrite_image_clc().

◆ fwrite_image_clc()

I32 fwrite_image_clc ( char *  path,
U16 rlc,
U16 clc 
)

This function writes the CLC image defined by image variable rlc and clc as a color bitmap file (BMP) to the file specified by path. The color represents its clc value by going from its minimum clc value to its maximum: Red -> Orange -> Yellow -> Green -> Cyan -> Blue -> Violet -> Pink. The pixel is turned black if a background pixel is detected (colBg=*(clc+3)).

The image is stored in 24 Bit true-color mode.

Parameters
pathThe Destination File.
rlc,clcSource Image Pointer.
Memory Consumption
None.
See also
fwrite_image().
Return values
ERR_MEMORYon memory allocation failure.
Returns
any error of the fwrite_image() function.

◆ mask_polygon()

I32 mask_polygon ( image psImgIn,
image psImgOut,
U8  color,
U32  u32CornerCount,
I32 pi32PxLst,
U8  u8OutputSizeToSelectionIff1 
)

The function fills all but a polygon shaped image region. The polygon contour, especially the points provided, are not part of the mask being set to the given color color, the inner of the polygon remains untouched. The function can be used to restrict one of the functions from the group 'Multiple Pixels to Values Mappings' to only a part of the image e.g., histogram of a polygon shaped area.

mask_polygon.png
Parameters
psImgInThe Source Image of Type IMAGE_GREY.
psImgOutThe Destination Image (may be equal to psImgIn).
colorThe Fill Color.
u32CornerCountCount of Corners of the Polygon.
pi32PxLstList of u32CornerCount Point Coordinates as Pixel List [I32 p1x, I32 p1y, I32 p2x, ...].
u8OutputSizeToSelectionIff1recalculates psImgOut->dx, psImgOut->dy to fit the selection, use a psImgIn sized allocation for the psImgOut target!
Return values
ERR_PARAMif (u32CornerCount < 3)
ERR_NONEon Success.
ERR_RLCFMTif Internal RLC Generation fails.
ERR_SLCif Internal SLC Generation fails.
ERR_PARAMif given Polygon is not OK, e.g., Self Overlapping, Crossing Image Border.
ERR_INCONSif rlc_mask_image() fails.
ERR_RLCFMTif rl_ftr2() fails.
ERR_BOUNDSif a Point lies Outside of an Image.
ERR_SINGULARif Singular or Self Intersecting.
ERR_MEMORYif Memory Allocation fails.