VCLib Documentation  6.12.2

Values to Pixels Mappings

Values to Pixels Mappings

Functions

I32 set (image *a, I32 x)
 Set Image Content to a Constant Value. More...
 
I32 vset (image *a, I32 mag, I32 dir)
 Set Vector Image Content to a Constant Value. More...
 
I32 set_with_bitmask (image *a, I32 color, U32 mask)
 Set Image Content to a Constant Value. More...
 
I32 mask_frame (image *src, I32 sx0, I32 sx1, I32 sy0, I32 sy1, I32 color)
 Mask a Frame with programmable Frame Width. 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...
 
I32 cset (image *rgb, I32 cc0, I32 cc1, I32 cc2)
 Set Color Image Content to a Constant Value. More...
 

Detailed Description

Functions in this group use a few values to calculate image pixel data, for example functions which set all pixel to the same value, or generate test patterns.

Functions drawing geometrical shapes can be found at Drawing Pixels.

Function Documentation

◆ set()

I32 set ( image a,
I32  color 
)

Sets all pixels of the st channel of an image variable to the constant value color.

Parameters
aTarget Image.
colorValue to set.
Memory Consumption
None.
Return values
ERR_TYPEif Image Type is wrong.
ERR_NONEon Success.

◆ vset()

I32 vset ( image a,
I32  mag,
I32  dir 
)

Sets all pixels of the st channel (the magnitude) and the ccmp1 channel (the direction) of an image variable to the constant values mag respective dir.

Parameters
aTarget Image.
magMagnitude Value to set (st).
dirDirection Value to set (ccmp1).
Memory Consumption
None.
Return values
ERR_TYPEif Image is not of Class 2 or Pixel Bit Count is not 8, or Image Type is wrong.
ERR_NONEon Success.

◆ cset()

I32 cset ( image rgb,
I32  cc0,
I32  cc1,
I32  cc2 
)

The function sets all pixels of a color image variable to the constant values cc0 (first color component), cc1 (second color component) and cc2 (third color component). The function may be used for the following color image types:

type cc0 cc1 cc2
IMAGE_RGB Red Green Blue
IMAGE_CBCR444 Y Cb Cr
IMAGE_CBCR422 Y Cb Cr
IMAGE_CBCR411 Y Cb Cr
IMAGE_IHS I H S
Memory Consumption
None.
See also
set(), vset().
Return values
ERR_NONEon Success.
ERR_TYPEif Image Type is not IMAGE_RGB, IMAGE_CBCR444, IMAGE_CBCR422, IMAGE_CBCR411 or IMAGE_IHS.
ERR_NONEon Success.
ERR_TYPEif Image Type is not IMAGE_RGB, IMAGE_CBCR444, IMAGE_CBCR422, IMAGE_CBCR411 or IMAGE_IHS.

◆ set_with_bitmask()

I32 set_with_bitmask ( image a,
I32  color,
U32  mask 
)

Sets all pixels of the st channel of an image variable to the constant value color. The mask bits define the bits which are overwritten (1) at the destination, others remain untouched (0).

Parameters
aTarget Image.
colorValue to set.
Note
only 8 bit images are supported so far.
Memory Consumption
None.
Return values
ERR_TYPEif Image Type is wrong.
ERR_NONEon Success.

◆ mask_frame()

I32 mask_frame ( image src,
I32  sx0,
I32  sx1,
I32  sy0,
I32  sy1,
I32  color 
)

This function sets a frame inside the image src to the value color. Hence only the image boundary is filled with the value color.

Parameters
srcSource Image Variable of Type IMAGE_GREY, IMAGE_RGB, IMAGE_CBCR444, IMAGE_CBCR422, IMAGE_CBCR411, IMAGE_IHS or IMAGE_VECTOR.
sx0Frame Width on Left Side.
sx1Frame Width on Right Side.
sy0Frame Heigth on Top Side.
sy1Frame Height on Bottom Side.
colorColor that is written to Frame.
Memory Consumption
None.
Return values
ERR_TYPEif Channel Type of Image differs from 8 Bit.

◆ 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.