Functions | |
I32 | mirror_hor (image *src, image *dst) |
Mirror Image Horizontally. More... | |
I32 | mirror_ver (image *src, image *dst) |
Mirror Image Vertically. More... | |
I32 | rotate90l (image *src, image *dst) |
Rotate Image by 90 Degrees Counter-Clockwise. More... | |
I32 | rotate90r (image *src, image *dst) |
Rotate Image by 90 Degrees Clockwise. More... | |
I32 | rotate180 (image *src, image *dst) |
Rotate Image by 180 Degrees. More... | |
void | xshear (image *src, F32 shear, image *dst, F32 offset, U8 bgnd) |
Horizontal Image Shear. More... | |
I32 | move_image_alpha (image *src, image *dst, F32 mx, F32 my, U8 bgnd) |
Subpixel Interpolated XY-Movement of Image. More... | |
I32 | pyramidx (image *a, image *b, void(*func)()) |
Pyramid Reduction for Images. More... | |
I32 | pyramidc (image *a, image *b, void(*func)()) |
Pyramid Reduction for Color Images. More... | |
void | subsample (image *a, image *b, I32 rh, I32 rv) |
Subsampling of Images. More... | |
void | zoom_up (image *a, image *b, I32 factor) |
Enlargement of an Image. More... | |
void | zoom_up_xy (image *a, image *b, I32 fx, I32 fy) |
Enlargement of an Image. More... | |
I32 | threepoint_calculate (point *p0, point *p1, point *p2, point *q0, point *q1, point *q2, F32 **a, F32 *t) |
Calculates the Inverse Affine Transformation Matrix for 2×3 Coordinate Points. More... | |
void | calc_rotation_matrix (F32 angle, F32 cx, F32 cy, F32 a[2][2], F32 t[2]) |
Calculates the Inverse Rotation Matrix and Vector for a Clockwise Rotation around a Center Point. More... | |
void | calc_rotation (F32 angle, point *p, point *target_p, F32 a[2][2], F32 t[2]) |
Sample Point driven Calculation of the Inverse Rotation Matrix and Vector for a Clockwise Rotation. More... | |
I32 | affine_image_transform (image *src, image *dst, F32 a[2][2], F32 t[2], U8 bgnd) |
Subpixel Interpolated (Inverse) Affine Image Transformation. More... | |
I32 | affine_image_transform2 (image *src, image *dst, F32 a[2][2], F32 t[2], U8 bgnd) |
Subpixel Interpolated (Inverse) Affine Image Transformation using float. More... | |
I32 | affine_image_transform3 (image *src, image *dst, F32 a[2][2], F32 t[2], U8 bgnd) |
Quadratic Subpixel Interpolated (Inverse) Affine Image Transformation using Integers. More... | |
I32 | affine_pixellist_transform (I32 *src, I32 *dst, U32 pxCount, F32 a[2][2], F32 t[2]) |
Pixellist (Inverse) Affine Transformation. More... | |
I32 | vc_line_greys (U8 *px, I32 *pxCnt, I32 pxMaxBytes, image *a, I32 x1In, I32 y1In, I32 x2In, I32 y2In, I32 *x1UsedOrNULL, I32 *y1UsedOrNULL, I32 *x2UsedOrNULL, I32 *y2UsedOrNULL) |
Grey Value Extraction at a Bresenham Line of an Image. More... | |
I32 | vc_line_greys_scaled (U8 *px, I32 *pxCnt, I32 pxMaxBytes, image *a, F32 x1In, F32 y1In, F32 x2In, F32 y2In, I32 scale, F32 *x1UsedOrNULL, F32 *y1UsedOrNULL, F32 *x2UsedOrNULL, F32 *y2UsedOrNULL) |
Grey Value Extraction at a Bresenham Line of an Image (subpixel interpolated scale) More... | |
I32 | resample_image (image *src, image *dst, I32(*func)()) |
Subpixel Interpolated Image Resampling Transformation. More... | |
#define | pyramid(a, b) pyramidx(a, b, (void (*)())FL_2x2_PAV_U8P_U8P) |
Pyramid Filter for Image Variable. More... | |
#define | pyr_max(a, b) pyramidx(a, b, (void (*)())FL_2x2_PMX_U8P_U8P) |
Pyramid Filter Maximum for Image Variable. More... | |
#define | pyr_min(a, b) pyramidx(a, b, (void (*)())FL_2x2_PMN_U8P_U8P) |
Pyramid Filter Minimum for Image Variable. More... | |
#define | pyr_col(a, b) pyramidc(a, b, (void (*)())FL_2x2_PAC_U8P_U8P) |
Pyramid Averaging Filter for Bayer Pattern Image Variable. More... | |
I32 | AffineInitTable (I32 mode) |
Allocates and Initializes a Unit Vector Table for Affine Biquadratic Transform. More... | |
void | AffineDeinitTable () |
Deallocates the Interpolation Table for Affine Biquadratic Transform. More... | |
#define | resample_bilinear(src, dst) resample_image(src, dst, (I32 (*)())affine_image_transform) |
Image Resampling to the Destination Image Size Using Bilinear Interpolation (Macro). More... | |
#define | resample_quadratic(src, dst) resample_image(src, dst, (I32 (*)())affine_image_transform3) |
Image Resampling to the Destination Image Size Using Quadratic Interpolation (Macro). More... | |
Affine transformations map pixels to different pixels using a linear mapping. All affine transformations can be specified by the following formula:
where
With the above formula any combination of the following transformation may be performed:
For the function affine_image_transform() the inverse transformation matrix is used. The functions calc_rotation_matrix(), calc_rotation() and threepoint_calculate() return the inverse matrix and vector which can than be used by the affine_image_transform() routine:
where
#define pyramid | ( | a, | |
b | |||
) | pyramidx(a, b, (void (*)())FL_2x2_PAV_U8P_U8P) |
The macro computes the pyramid filter operation of an image defined by image variable a
. The result is stored in image b
.
a1 | a2 |
a3 | a4 |
Four values of the source image are combined to one pixel of the destination image according to the following formula:
pyramid() is a macro which calls pyramidx() with basic function FL_2x2_PAV_U8P_U8P() as an argument.
#define pyr_max | ( | a, | |
b | |||
) | pyramidx(a, b, (void (*)())FL_2x2_PMX_U8P_U8P) |
The macro computes the pyramid filter operation of an image defined by image variable a
. The result is stored in image b
.
a1 | a2 |
a3 | a4 |
Four values of the source image are combined to one pixel of the destination image according to the following formula:
pyr_max() is a macro which calls pyramidx() with basic function FL_2x2_PMX_U8P_U8P() as an argument.
#define pyr_min | ( | a, | |
b | |||
) | pyramidx(a, b, (void (*)())FL_2x2_PMN_U8P_U8P) |
The macro computes the pyramid filter operation of an image defined by image variable a
. The result is stored in image b
.
a1 | a2 |
a3 | a4 |
Four values of the source image are combined to one pixel of the destination image according to the following formula:
pyr_min() is a macro which calls pyramidx() with basic function FL_2x2_PMN_U8P_U8P() as an argument.
#define pyr_col | ( | a, | |
b | |||
) | pyramidc(a, b, (void (*)())FL_2x2_PAC_U8P_U8P) |
This macro performs a pyramid reduction for color images coded as a bayer pattern image: 2×2 pixels of source are averaged and written to 1 pixel at the destination image.
pyr_col() is a macro which calls pyramidc() with basic function FL_2x2_PAC_U8P_U8P() as an argument.
#define resample_bilinear | ( | src, | |
dst | |||
) | resample_image(src, dst, (I32 (*)())affine_image_transform) |
The macro resamples the source image content to the dimensions of the destination image using a bilinear interpolation.
src | Points to Source Image. |
dst | Points to Destination Image. |
resample_bilinear() is a macro which calls resample() with basic function affine_image_transform() as an argument.
#define resample_quadratic | ( | src, | |
dst | |||
) | resample_image(src, dst, (I32 (*)())affine_image_transform3) |
The macro resamples the source image content to the dimensions of the destination image using a quadratic interpolation.
src | Points to Source Image. |
dst | Points to Destination Image. |
resample_bilinear() is a macro which calls resample() with basic function affine_image_transform3() as an argument.
The function mirrors an image horizontally with respect to its central axis. It is possible to use the function in-place, i.e. source and destination images may be identical. In this case, the function uses a slightly faster exchange-and-reverse routine.
If source and destination images are not identical but overlap, the result is not defined. The function mirrors the whole image if src
and dst
image have equal dimensions. If this is not the case, only a fraction of the source image is mirrored with the following dimensions: dx
= min( src->dx, dst->dx), dy
= min( src->dy, dst->dy)
ERR_NONE | on Success. |
The function mirrors an image vertically with respect to its central axis. It is possible to use the function in-place, i.e. source and destination images may be identical. In this case, the function uses a slightly faster exchange-and-reverse routine.
If source and destination images are not identical but overlap, the result is not defined. The function mirrors the whole image if src
and dst
image have equal dimensions. If this is not the case, only a fraction of the source image is mirrored with the following dimensions: dx
= min( src->dx, dst->dx), dy
= min( src->dy, dst->dy).
ERR_NONE | on Success. |
The function rotates an image by 90 degrees counter-clockwise. It is not possible to use the function in-place, i.e. source and destination images must not overlap.
The function rotates the whole image if src
and dst
image have equal dimensions.
If this is not the case, only a fraction of the source image is rotated with the following dimensions:
dx
= min( src->dx, dst->dy) dy
= min( src->dy, dst->dx).
The function splits the source image into tiles which can be processed very efficiently even with limited cache memory size.
ERR_TYPE | if Image Types are not identical or wrong. |
ERR_NONE | on Success. |
The function rotates an image by 90 degrees clockwise.
Please refer to the documentation of rotate90l() for the details.
ERR_TYPE | if Image Types are not identical or wrong. |
ERR_NONE | on Success. |
The function rotates an image by 180 degrees. It is possible to use the function in-place, i.e. source and destination images may be identical. In this case, the function uses a slightly faster exchange-and-reverse routine.
If source and destination images are not identical but overlap, the result is not defined. The function rotates the whole image if src
and dst
image have equal dimensions.
If this is not the case, only a fraction of the source image is rotated with the following dimensions:
dx
= min( src->dx, dst->dx), dy
= min( src->dy, dst->dy).
ERR_NONE | on Success. |
The function performs a horizontal image shear of the source image by a shear factor of shear
. A horizontal displacement offset offset
may be added. Pixels for which the corresponding source image is not defined, are set to bgnd
.
If source and destination images are not identical but overlap, the result is not defined.
The function moves an image by a fractional number of pixels in x and y direction using bilinear interpolation.
The offset vector (mx
, my
) is added to the start of source image. The image is then copied using bilinear interpolation. If (mx
, my
) = (0, 0), the result of the operation is the same as for the copy() function. The resulting image always has the dimensions of the destination image. Missing areas are set to bgnd
. The function also performs a bilinear interpolation between edges of the source image and the background color where applicable.
It is possible to use the function in-place if my<0
, otherwise the result is not defined.
src | Pointer to Source Image. |
dst | Pointer to Destination Image. |
mx | Movement Vector x, mx > 0: Movement to Right. |
my | Movement Vector y, my > 0: Downward Movement. |
bgnd | Background Color. |
ERR_FORMAT | if src or dst is NULL. |
ERR_MEMORY | if Memory Allocation fails. |
ERR_NONE | on Success. |
The function computes the pyramid filter operation of an image defined by image variable a
. The result is stored in image b
.
a1 | a2 |
a3 | a4 |
Four values of the source image are combined to one pixel of the destination image. The nature of the operation is defined by the basic function func()
.
The following macros use this function:
Call | Basic function |
---|---|
pyramid(a, b) | FL_2x2_PAV_U8P_U8P() |
pyr_max(a, b) | FL_2x2_PMX_U8P_U8P() |
pyr_min(a, b) | FL_2x2_PMN_U8P_U8P() |
Please note that the result image is smaller by the factor of two in both the horizontal and vertical direction. The operation may be performed in-place, i.e. a
and b
may be equal.
ERR_TYPE | if not Grey Compatible Image. |
ERR_NONE | on Success. |
This function performs a pyramid reduction for color images coded as a bayer pattern image.
The following macros are available:
Call | Basic function |
---|---|
pyr_col(a, b) | FL_2x2_PAC_U8P_U8P() |
Please note that the result image is smaller by the factor of two in both the horizontal and vertical direction.
The operation may be performed in-place, i.e. src and dst may be equal.
src | Source Image of Type IMAGE_BAYER. |
dst | Destination Image of Type IMAGE_BAYER. |
func | Points to Low-level Pyramid Function. |
ERR_TYPE | if Image Type is not IMAGE_BAYER. |
ERR_NONE | on Success. |
The function copies the image defined by image variable a
into image variable b
and reduces its size. rh
and rv
specify the horizontal (rh
) and vertical (rv
) subsampling ratio.
Constraints: rh
, rv
> 0
rh=2
means that every other pixel of an original image line will be taken and stored to the result image. The horizontal image width of the result image will be half the source image width.
The function enlarges the pixels in image variable a
by factor and stores the result in image variable b
. If the size of b
is not sufficient for this operation the maximum size will be truncated to the size of b
.
The function enlarges the pixels in image variable a
by factors fx and fy and stores the result in image variable b
. If the size of b
is not sufficient for this operation the maximum size will be truncated to the size of b
.
I32 threepoint_calculate | ( | point * | p0, |
point * | p1, | ||
point * | p2, | ||
point * | q0, | ||
point * | q1, | ||
point * | q2, | ||
F32 ** | a, | ||
F32 * | t | ||
) |
Input to the function are three known points in the original coordinate system and their image points in the transformed coordinate system.
[in] | p0,p1,p2 | Sample Point Positions before Transformation. |
[in] | q0,q1,q2 | Sample Point Positions after Transformation. |
[out] | a | Inverse 2D Transformation Matrix 2×2. |
[out] | t | Inverse 2D Translation Vector 2×1. |
ERR_MEMORY | if Memory Allcoation failed. |
ERR_SINGULAR | if Transformation Matrix is Singular. |
ERR_NONE | on Success. |
The function calculates the inverse rotation matrix a
[2][2] and the translation vector t
[2] for a clockwise rotation with respect to a given center point. Matrix a
may then be used, for example, by affine_image_transform().
[in] | angle | Angle for Clockwise Rotation in Degrees. |
[in] | cx,cy | Rotation Center Coordinate. |
[out] | a | Inverse 2D Transformation Matrix. |
[out] | t | Inverse 2D Translation Vector. |
The function calculates the inverse rotation matrix a
[2][2] and the translation vector t
[2] for a clockwise rotation with respect to a given angle and a sample mapping going from position p
to the position target_p
.
An important special case is p
= target_p
= center of rotation.
[in] | angle | Angle for Clockwise Rotation in Degrees. |
[in] | p | Sample Coordinate Position before Rotation. |
[in] | target_p | Sample Coordinate Position after Rotation. |
[out] | a | Inverse 2D Transformation Matrix. |
[out] | t | Inverse 2D Translation Vector. |
This function performs a general affine image transformation on the source image and outputs the result to the destination image. The function uses bilinear interpolation.
The resulting image always has the dimensions of the destination image. Missing areas are set to bgnd
. Please be aware, that the function needs the inverse transformation matrix and translation vector as an input. It is not possible to use the function in-place, i.e. source and destination images must not overlap.
src | Pointer to Source Image. |
dst | Pointer to Destination Image. |
a | Inverse 2D Transformation Matrix. |
t | Inverse 2D Translation Vector. |
bgnd | Background Grey Value. |
ERR_FORMAT | if src or dst is NULL. |
ERR_NONE | on Success. |
Same as affine_image_transform() but with (slow) floating-point calculation. It is recommmended to use function affine_image_transform() instead. Be aware that the inverse transformation matrix is required.
src | pointer to source image |
dst | pointer to destination image |
a | inverse 2D transformation matrix |
t | inverse 2D translation vector |
bgnd | background grey value |
ERR_FORMAT | if src or dst is NULL. |
ERR_NONE | on Success. |
This function performs a subpixel interpolated affine transformation of image using integer values performing a quadratic interpolation. Be aware that the inverse transformation matrix is required.
This function uses an interpolation table which is allocated and calculated automatically for the first call of the function. The table may be set by the user using the function AffineInitTable(). Please make sure to call the function AffineDeinitTable() when the table is no longer needed.
[in] | src | Points to Source Image. |
[out] | dst | Points to Destination Image. |
[in] | a | Inverse 2D Transformation Matrix. |
[in] | t | Inverse 2D Translation Vector. |
[in] | bgnd | Background Grey Value. |
ERR_FORMAT | if src or dst is NULL. |
ERR_TYPE | if Image Variable Type of src or dst is not of Type IMAGE_GREY, IMAGE_CBCR444, IMAGE_CBCR422, IMAGE_CBCR411, IMAGE_YUVNORM, IMAGE_IHS, IMAGE_VECTOR. |
ERR_MEMORY | if Memory Allocation fails. |
ERR_NONE | on Success. |
This function performs a general affine image transformation on the source pixel list and outputs the result to the destination pixel list. Output pixels are rounded to its next integer positions.
Please be aware, that the function needs the inverse transformation matrix and translation vector as an input. It is possible to use the function in-place, i.e. source and destination pixel lists may be identical.
src | Pointer to Source Pixel List. |
dst | Pointer to Destination Pixel List. |
pxCount | Count of Pixels in List. |
a | Inverse 2D Transformation Matrix. |
t | Inverse 2D Translation Vector. |
ERR_NONE | always. |
mode | Transformation Selector:
|
ERR_MEMORY | if Memory Allocation fails. |
ERR_NONE | on Success. |
ERR_MEMORY | if Memory Allocation fails. |
ERR_NONE | on Success. |
void AffineDeinitTable | ( | ) |
The function deallocates the interpolation table for affine transform allocated after calling AffineInitTable().
I32 vc_line_greys | ( | U8 * | px, |
I32 * | pxCnt, | ||
I32 | pxMaxBytes, | ||
image * | a, | ||
I32 | x1In, | ||
I32 | y1In, | ||
I32 | x2In, | ||
I32 | y2In, | ||
I32 * | x1UsedOrNULL, | ||
I32 * | y1UsedOrNULL, | ||
I32 * | x2UsedOrNULL, | ||
I32 * | y2UsedOrNULL | ||
) |
This function extracts grey values of an image lying at a bresenham line. If the given line exceeds the image, only a partial sub-line will be extracted instead. The first coordinate is the coordinate of x1In
, y1In
or its replacement if the coordinate exceeds the image. The last coordinate is the coordinate of x2In
, y2In
or its replacement if the coordinate exceeds the image.
Given with pxMaxBytes
the output px
array must provide at least max(2 * sizeof(I32), sizeof(U8*)) * (1 + max(abs(x2-x1), abs(y2-y1))) bytes.
px,pxCnt | The result grey value array and its entry number |
pxMaxBytes | The maximum px entries allowed, must be at least max(2 * sizeof(I32), sizeof(U8*)) * (1 + max(abs(x2-x1), abs(y2-y1))) bytes. |
a | The 8-bit grey value image where pixels will be extracted from |
x1In,y1In,x2In,y2In | The requested line of coordinates to be extracted |
x1UsedOrNULL,y1UsedOrNULL,x2UsedOrNULL,y2UsedOrNULL | Optional pointers to get the sub-line used (you may use x1In ... pointers for overwriting) |
I32 vc_line_greys_scaled | ( | U8 * | px, |
I32 * | pxCnt, | ||
I32 | pxMaxBytes, | ||
image * | a, | ||
F32 | x1In, | ||
F32 | y1In, | ||
F32 | x2In, | ||
F32 | y2In, | ||
I32 | scale, | ||
F32 * | x1UsedOrNULL, | ||
F32 * | y1UsedOrNULL, | ||
F32 * | x2UsedOrNULL, | ||
F32 * | y2UsedOrNULL | ||
) |
This function extracts grey values of an image lying at a bresenham line. A scale
factor can be given for the output: The upscaled bresenham line positions are bilinearly interpolated between the surrounding four pixel coordinates. If the given line exceeds the image, only a partial sub-line will be extracted instead. The first coordinate is the (scale
rounded) subpixel coordinate of x1In
, y1In
or its replacement if the coordinate exceeds the image. The last coordinate is the (scale
rounded) subpixel coordinate of x2In
, y2In
or its replacement if the coordinate exceeds the image.
Given with pxMaxBytes
the output px
array must provide at least scale * line length bytes, or processing will fail.
px,pxCnt | The result grey value array and its entry number |
pxMaxBytes | The maximum px entries allowed, must be at least scale * line length bytes |
a | The 8-bit grey value image where pixels will be extracted from |
x1In,y1In,x2In,y2In | The requested line of coordinates to be extracted (rounded to 1/scale ) |
scale | The scale factor used: almost each coordinate at the line scale subpixels are interpolated and outputted |
x1UsedOrNULL,y1UsedOrNULL,x2UsedOrNULL,y2UsedOrNULL | Optional pointers to get the sub-line used (you may use x1In ... pointers for overwriting) |
The source image is resampled to the size of the destination image. Depending on the function pointer used, the operation can be bilinear, biqudratic or differently interpolated.
src | Points to Source Image. |
dst | Points to Destination Image. |
func() | Points to Affine Transformation. |