VCLib Documentation  6.12.2

Pixel List Functions

Pixel List Functions

Functions

I32 clip (I32 N, I32 *xy_src, I32 *xy_dst, I32 x_max, I32 x_min, I32 y_max, I32 y_min)
 Performs Window-Clipping for Coordinates at a Pixellist. More...
 
void translate (I32 N, I32 *xy_src, I32 *xy_dst, I32 mx, I32 my)
 Translates Coordinates of a Pixellist. More...
 
I32 PL_line_stats (I32 *xy, I32 nr, vcline *line, F32 *dmin, F32 *dmax, F32 *sigma)
 Line Statistics for a Pixellist (I32 integer variant). More...
 
I32 PL_line_statsF (F32 *xy, I32 nr, vcline *line, F32 *dmin, F32 *dmax, F32 *sigma)
 Line Statistics for a Pixellist (F32 floating point variant). More...
 
I32 PL_line_ending (I32 *xy, I32 nr, vcline *line, I32 *imin, I32 *imax)
 Pixellist Extrema regarding to a Line's Direction (I32 integer variant). More...
 
I32 PL_line_endingF (F32 *xy, I32 nr, vcline *line, I32 *imin, I32 *imax)
 Pixellist Extrema regarding to a Line's Direction (F32 floating point variant). More...
 
F32 PL_line_bendingF (F32 *xy, I32 nr, vcline *line)
 Calculate a Bending Factor of a Line Shaped Pixellist. More...
 
void PL_transform (I32 N, I32 *xy_src, I32 *xy_dst, I32 mx, I32 my, F32 sx, F32 sy)
 Linear Transforms Coordinates of a Pixellist. More...
 
void PL_reverse (I32 *xylist, I32 n)
 Reverse Order of Elements at a Pixellist. More...
 

Detailed Description

Function Documentation

◆ clip()

I32 clip ( I32  N,
I32 xy_src,
I32 xy_dst,
I32  x_min,
I32  x_max,
I32  y_min,
I32  y_max 
)

The function performs window-clipping for the (x, y) coordinates in the pixellist. The coordinates are copied from xy_src to xy_dst, if they are in a rectangle defined by x_min, x_max, y_min and y_max, i.e. (x_min <= x < x_max) and (y_min <= y < y_max) It is allowed to use the function in-place, i.e. xy_dst = xy_src.

Parameters
NCount of Coordinates in xy_src
xy_srcSource Pixellist.
xy_dstDestination Pixellist.
x_min,x_max,y_min,y_maxBorders, see Text.
Return values
CountCount of Coordinates in the result list xy_dst.
Memory Consumption
None.

◆ translate()

void translate ( I32  N,
I32 xy_src,
I32 xy_dst,
I32  mx,
I32  my 
)

The function performs a translation operation for the (x, y) coordinates in the pixellist xy_src. The vector (mx, my) is added to all coordinates, the result is written to xy_dst. It is allowed to use the function in-place, i.e. xy_dst = xy_src.

Parameters
NCount of Coordinates in xy_src and xy_dst.
xy_srcSource Pixellist.
xy_dstDestination Pixellist.
mx,myTranslation.
Memory Consumption
None.

◆ PL_line_stats()

I32 PL_line_stats ( I32 xy,
I32  nr,
vcline line,
F32 dmin,
F32 dmax,
F32 sigma 
)

The function calculates some statistics for a line that comes in two representations:

  • as vcline* line in normalized vector representation,
  • as a pixel-list (I32* xy).

The normalized vector representation could be the output of the function bestline(), the line between the first and the last point of the list or any other preferred line. The pixel-list xy could be the result of the contour algorithm, a Hough-line, extracted with the function GetHoughPixels(), or any other source.

The function parses through the points in the list and calculates the closest distance to the theoretical line line. It outputs the minimum (dmin, should be a negative value or 0, representing a deviation on one side of the line) and the maximum (dmax, should be a positive value or 0, representing a deviation on the other side of the line) and the standard deviation sigma, which is the square root of the sum of the squared differences divided by the number nr of pixels in the list.

Return values
ERR_NONEOn Success.

◆ PL_line_statsF()

I32 PL_line_statsF ( F32 xy,
I32  nr,
vcline line,
F32 dmin,
F32 dmax,
F32 sigma 
)

The function calculates some statistics for a line that comes in two representations:

  • as vcline* line in normalized vector representation,
  • as a pixel-list (F32* xy).

The normalized vector representation could be the output of the function bestline(), the line between the first and the last point of the list or any other preferred line. The pixel-list xy could be the result of the contour algorithm, a Hough-line, extracted with the function GetHoughPixels(), or any other source.

The function parses through the points in the list and calculates the closest distance to the theoretical line line. It outputs the minimum (dmin, should be a negative value or 0, representing a deviation on one side of the line) and the maximum (dmax, should be a positive value or 0, representing a deviation on the other side of the line) and the standard deviation sigma, which is the square root of the sum of the squared differences divided by the number nr of pixels in the list.

Return values
ERR_NONEOn Success.

◆ PL_line_ending()

I32 PL_line_ending ( I32 xy,
I32  nr,
vcline line,
I32 imin,
I32 imax 
)

The function calculates the first and the last pixel of the pixel-list in the direction of vcline* line and outputs the index of the corresponding coordinate. When the pixel-list is the result of a contour-following or the output of the function GetHoughPixels(), the pixels in the list are not ordered in general as a line. The function can also use arbitrary pixel-list and output the minimum and maximum coordinate in a given direction specified by vcline* line. The coordinate of the minimum and maximum pixels are then retrieved as follows:

I32 imin, imax, *xy;
I32 minx, miny, maxx, maxy;
PL_line_ending(xy, nr, line, &imin, &imax);
minx = xy[2*imin];
miny = xy[2*imin+1];
maxx = xy[2*imax];
maxy = xy[2*imax+1];
PL_line_ending.png
Return values
ERR_NONEOn Success.

◆ PL_line_endingF()

I32 PL_line_endingF ( F32 xy,
I32  nr,
vcline line,
I32 imin,
I32 imax 
)

The function calculates the first and the last pixel of the pixel-list in the direction of vcline* line and outputs the index of the corresponding coordinate. When the pixel-list is the result of a contour-following or the output of the function GetHoughPixels(), the pixels in the list are not ordered in general as a line. The function can also use arbitrary pixel-list and output the minimum and maximum coordinate in a given direction specified by vcline* line. The coordinate of the minimum and maximum pixels are then retrieved as follows:

F32 *xy;
I32 imin, imax;
F32 minx, miny, maxx, maxy;
PL_line_ending(xy, nr, line, &imin, &imax);
minx = xy[2*imin];
miny = xy[2*imin+1];
maxx = xy[2*imax];
maxy = xy[2*imax+1];
PL_line_ending.png
Return values
ERR_NONEOn Success.

◆ PL_line_bendingF()

F32 PL_line_bendingF ( F32 xy,
I32  nr,
vcline line 
)

Input to the function is the F32 floating point pixel-list xy which is interpreted as data of a 'real' line. line should be the ideal line or best-line calculated with the xy-data. The function calculates a heuristic 'bending value' for the xy-line which is higher if the line has a higher curvature. Pixels in the middle third of the line are averaged and compared to the rest of the line excluding 5 % of the line at its endings. The F32 output of the function has a magnitude in the order of the average pixel distance from the ideal line.

◆ PL_reverse()

void PL_reverse ( I32 xylist,
I32  n 
)

Reverse sequence of elements in pixel list.

The function operates in-place, i.e. the input list and the output list are identical.

Parameters
xylistpixel list input and output (in-place)
nnumber of element-pairs in pixel list

◆ PL_transform()

void PL_transform ( I32  N,
I32 xy_src,
I32 xy_dst,
I32  mx,
I32  my,
F32  sx,
F32  sy 
)

The function performs a translation operation for the (x, y) coordinates in the pixellist xy_src. The vector (mx, my) is added to all coordinates, then each component is scaled by its respective scale value sx or sy, the result is written to xy_dst. It is allowed to use the function in-place, i.e. xy_dst = xy_src.

Parameters
NCount of Coordinates in xy_src and xy_dst.
xy_srcSource Pixellist.
xy_dstDestination Pixellist.
mx,myTranslation.
sx,syScale.
Memory Consumption
None.