VCLib Documentation  6.12.2

Multiple Pixels to Values Mappings

Multiple Pixels to Values Mappings

Macros

#define area_centered_grey_value_quantile(imgIn, val, quantilePercent, xc, yc, cdx, cdy, ch)   area_grey_value_quantile(imgIn, val, quantilePercent, (xc)-((cdx)/2), (yc)-((cdy)/2), (cdx), (cdy), ch)
 Get Grey Value Quantile of an image area based around center (Macro). More...
 
#define image_grey_value_quantile(imgIn, val, quantilePercent, ch)   area_grey_value_quantile(imgIn, val, quantilePercent, 0, 0, (imgIn)->dx, (imgIn)->dy, ch)
 Get Grey Value Quantile of an image (Macro). More...
 

Functions

U32 arx (image *a, I32 thr)
 Count of Image Pixels above Threshold. More...
 
U32 arx2 (image *a, I32 th1, I32 th2)
 Count of Image Pixels between Two Thresholds. More...
 
I32 mean (image *a)
 Mean of Image's Grey Values. More...
 
U32 variance (image *a)
 Variance of Image's Grey Values. More...
 
I32 contrast (image *a)
 Contrast of Image's Grey Values. More...
 
U32 focus (image *a, I32 sh)
 Focal Value of an Image. More...
 
U32 SumImage (image *Src)
 Sum of all Image Pixel Values. More...
 
U40 ProdImage (image *Src1, image *Src2)
 Inner Product of Two Images. More...
 
I32 histo (image *a, U32 hist[])
 Histogram over Image's Grey Values. More...
 
I32 histo_at_rlc (image *img, U32 hist[256], U16 *rlc, U16 rlcCol)
 Histogram over RLC's Image Grey Values. More...
 
I32 histo_grey_value_quantile (U32 hist[256], U8 *val, I32 quantilePercent)
 Get Grey Value Quantile of a histo()-gram. More...
 
I32 histo_U32_value_quantile (U32 *hist, I32 entries, U32 *pos, I32 quantilePercent)
 
void projh (image *a, U32 result[])
 Horizontal Projection of an Image. More...
 
void projv (image *a, U32 result[])
 Vertical Projection of an Image. More...
 
I32 area_grey_value_quantile (image *imgIn, U32 *val, I32 quantilePercent, I32 x0, I32 y0, I32 dx, I32 dy, I32 ch)
 Get Grey Value Quantile of an image area. More...
 
I32 NormalizedCorrelationI32 (image *SearchX, image *Pattern, float MinContr, I32 *Corr, float *Contr, I32 *PosX, I32 *PosY)
 Normalized Correlation Returning I32 Correlation Value. More...
 
I32 contrastF (image *src, F32 *avg, F32 *contrast)
 Average Grey Value and Contrast Calculation. More...
 

Detailed Description

Functions in this group use a larger number of pixels of the source image in order to calculate a value or a number of values. Examples are projections and average calculations.

Macro Definition Documentation

◆ area_centered_grey_value_quantile

#define area_centered_grey_value_quantile (   imgIn,
  val,
  quantilePercent,
  xc,
  yc,
  cdx,
  cdy,
  ch 
)    area_grey_value_quantile(imgIn, val, quantilePercent, (xc)-((cdx)/2), (yc)-((cdy)/2), (cdx), (cdy), ch)

The macro calculates the grey value which is equal to or smaller than the given grey value quantile of the histogram, but always at least 0.

More information can be found at the called function area_grey_value_quantile().

◆ image_grey_value_quantile

#define image_grey_value_quantile (   imgIn,
  val,
  quantilePercent,
  ch 
)    area_grey_value_quantile(imgIn, val, quantilePercent, 0, 0, (imgIn)->dx, (imgIn)->dy, ch)

The macro calculates the grey value which is equal to or smaller than the given grey value quantile of the histogram, but always at least 0.

More information can be found at the called function area_grey_value_quantile().

Function Documentation

◆ arx()

U32 arx ( image a,
I32  thr 
)

The function calculates the count of pixels above (and not equals to) the threshold thr.

Memory Consumption
None.
See also
arx2().

◆ arx2()

U32 arx2 ( image a,
I32  th1,
I32  th2 
)

The function calculates the number of pixels between the thresholds th1 and th2.

Memory Consumption
None.
See also
arx().

◆ mean()

I32 mean ( image a)

The function calculates the mean value of an image variable. The value is rounded and returned to the calling function. There is no restriction for the format of the image.

The mean is the sum of all pixel values in the image divided by the image area.

Memory Consumption
None.
See also
variance(), histo(), projh(), projv().

◆ variance()

U32 variance ( image a)

The function calculates the statistical variance of an image variable. The value is rounded and returned to the calling function. There is no restriction for the format of the image like for earlier VCLIB.

The variance is the sum of all pixel values squared divided by the image area.

The variance can be used to measure the contrast, e.g the presence or absence of high contrast structures like printing, etc.

Memory Consumption
None.
See also
mean(), histo(), projh(), projv().

◆ contrast()

I32 contrast ( image a)

The function calculates the average contrast in image variable a.

Contrast is defined as the standard deviation of the grey values of all pixels in the image variable. The maximum allowed size of the image variable is 65536 pixels (e.g. 256×256)

See also
vc_corr0().

◆ contrastF()

I32 contrastF ( image src,
float *  avg,
float *  contrast 
)

The function calculates the average grey value and the average contrast in image variable src.

Contrast is defined as the standard deviation of the grey values of all pixels in the image variable. The maximum allowed size of the image variable is 4096×4096-1 pixels.

See also
contrast(), mean().

◆ focus()

U32 focus ( image a,
I32  sh 
)

The function calculates the relative focus measure of the image variable a. sh is a shift value to suppress noise. sh=0 means no shift, sh=-1 is equivalent to dividing by 2, sh=-2 is equivalent to dividing by 4, etc. The focal value is calculated according to the following procedure:

a1a2
b1b2

a1 and a2 are adjacent Pixels in the upper line, b1 and b2 are adjacent pixels in the lower line. We have:

\[ focus := \sum\left(\left( | a1 - a2 | + | a1 - b1 | \right) \gg (-sh) \right) \]

The summation is performed for all ((dx-1)*(dy-1)) pixels of the image variable.

Note
The relative focus measure calculated by the above formula depends upon the mean brightness of the image field used. Thus, the formula is only recommended for evaluating the focus if the individual images used for the comparison have similar values for the mean brightness.
Memory Consumption
None.

◆ SumImage()

U32 SumImage ( image Src)

This function sums up all the pixels in an image. The result is U32, therefore (2^24-1) pixels may be in the image, e.g. almost 4096×4096 pixels.

Parameters
SrcImage with Pixels to Sum Up.
Return values
SumEquals to $ \sum_{px}(Src_{px}) $.

◆ ProdImage()

U40 ProdImage ( image Src1,
image Src2 
)

This function calculates the cross-correlation or inner product between two images. Line summation is done with U32, therefore the maximum line width is (2^16-1) = 65535. The line summation is done with U40, so that the maximum image size is (2^24-1), e.g. almost 4096×4096 pixels.

Parameters
Src1First Image.
Src2Second Image.
Return values
Inner ProductEquals to $ \sum_{px}(Src1_{px} \cdot Src2_{px}) $.

◆ histo()

I32 histo ( image a,
U32  hist[] 
)

The function calculates the histogram of the image variable a. The histogram is the absolute frequency of the 256 different gray scales in an image/image window. In addition to the image variable a, a pointer to an array with 256 values is passed to the function. After calling the function, the result can be taken from this array.

Parameters
aSource Image
histTarget Histogram
Memory Consumption
None.
See also
mean(), variance().

◆ histo_at_rlc()

I32 histo_at_rlc ( image img,
U32  hist[256],
U16 rlc,
U16  rlcCol 
)

The function calculates the histogram of all pixels of the image variable a where a given run length code rlc has a specified color rlcCol. The histogram is the absolute frequency of the 256 different gray scales in an image/image window. In addition to the image variable a, a pointer to an array with 256 values is passed to the function. After calling the function, the result can be taken from this array.

Parameters
aSource Image of type IMAGE_GREY.
histTarget Histogram
rlc,rlcColRegions at rlc (unlabelled RLC) with color rlcCol will be selected for histogram building
Memory Consumption
None.
See also
histo(), mean(), variance().

◆ histo_grey_value_quantile()

I32 histo_grey_value_quantile ( U32  hist[256],
U8 val,
I32  quantilePercent 
)

The function calculates the grey value which is equal to or smaller than the given grey value quantile of the histogram, but always at least 0.

Parameters
valgrey value, where at minimum (100% - quantilePercent) pixels of the area have a grey value which is bigger than this one.
Memory Consumption
None.
See also
image_grey_value_quantile(), areaCentered_grey_value_quantile().
mean(), variance(), histo().

◆ histo_U32_value_quantile()

I32 histo_U32_value_quantile ( U32 hist,
I32  entries,
U32 pos,
I32  quantilePercent 
)
Return values
1if grey value is 0, but quantile is lower.

◆ projh()

void projh ( image a,
U32  x[] 
)

The function calculates the horizontal projection of an image variable. Here, projection means the sum of all pixels in one line. The result is stored in the array result[dy]. result[0] is the projection of the first line, result[1] the projection of the second line, etc.

Memory Consumption
None.
See also
also projv().

◆ projv()

void projv ( image a,
U32  x[] 
)

The function calculates the vertical projection of an image variable. Here, projection means the sum of all pixels in one column. The result is stored in the array result[dx]. result[0] is the projection of the first column, result[1] is the projection of the second column, etc.

Memory Consumption
None.
See also
projh().

◆ area_grey_value_quantile()

I32 area_grey_value_quantile ( image imgIn,
U32 val,
I32  quantilePercent,
I32  x0,
I32  y0,
I32  dx,
I32  dy,
I32  ch 
)

The function calculates the grey value which is equal to or smaller than the given grey value quantile of the histogram, but always at least 0.

Parameters
imgInimage keeping the area to be processed.
valgrey value, where at minimum (100% - quantilePercent) pixels of the area have a grey value which is bigger than this one.
Memory Consumption
None.
See also
image_grey_value_quantile(), areaCentered_grey_value_quantile().
mean(), variance(), histo().
Return values
-1iff region is empty.
1iff region is smaller than the requested region.
-2iff Image Type is not IMAGE_GREY.
-3iff selected channel is not (yet) supported.
1if grey value is 0, but quantile is lower.

◆ NormalizedCorrelationI32()

I32 NormalizedCorrelationI32 ( image SearchX,
image Pattern,
float  MinContr,
I32 Corr,
float *  Contr,
I32 PosX,
I32 PosY 
)

This function calls the function NormalizedCorrelation(). It has been kept for compatibility reasons. In case of doubt we recommend using NormalizedCorrelation() directly.

Parameters
SearchXThe Image to be Searched In.
PatternThe Reference Pattern.
MinContrThe Minimum Contrast Requirement, can speed up the Search.
CorrCorrelation Value Output, Set to NULL, if not Required.
ContrContrast Value Output, Set to NULL, if not Required.
PosXx-Position Output, Set to NULL, if not Required.
PosYy-Position Output, Set to NULL, if not Required.