Functions | |
I32 | copy (image *a, image *b) |
Copy an Image Variable. More... | |
I32 | copy_with_bitmask (image *src, image *dst, U32 mask) |
Copies an Image: Only those Bits where Mask bits are set to One. More... | |
I32 | merge_with_bitmask (image *src0, image *src1, image *dst, U32 mask) |
Combines an Image out of two others using a bit mask selector. More... | |
void | bin0 (image *src, image *dest, I32 thr, I32 bl, I32 wt, void(*fc)()) |
Fast Binarization of an Image Variable. More... | |
void | img2 (image *a, image *b, image *c, void(*func)(), I32 q) |
Link Two Image Variables. More... | |
I32 | equalize (image *src, image *dst) |
Equalize Image. More... | |
I32 | look (image *a, image *b, U32 table[]) |
Look-up Table Function. More... | |
I32 | lookfalse (image *src, image *dst, U8 red[], U8 grn[], U8 blu[]) |
False Color Look-up Table Function. More... | |
void | SetFalseColorLUT (U8 *red, U8 *grn, U8 *blu) |
Writes False Color Look-up Table. More... | |
#define | add2(a, b, c, sh) img2(a, b, c, (void (*)())FL_add2f, sh) |
Pixelwise Sum of Two Images (Macro). More... | |
#define | sub2(a, b, c) img2(a, b, c, (void (*)())FL_sub2f, 0) |
Pixelwise Absolute Difference of Two Images (Macro). More... | |
#define | subx2(a, b, c, offs) img2(a, b, c, (void (*)())FL_sub2x, offs) |
Pixelwise Difference of Two Images with Clipping (Macro). More... | |
#define | suby2(a, b, c) img2(a, b, c, (void (*)())FL_sub2y, 0) |
Pixelwise Sign of Two Images (Macro). More... | |
#define | mul2(a, b, c, sh) img2(a, b, c, (void (*)())FL_mul2f, sh) |
Pixelwise Product of Two Images (Macro). More... | |
#define | max2(a, b, c) img2(a, b, c, (void (*)())FL_max2f, 0) |
Pixelwise Maximum of Two Images (Macro). More... | |
#define | min2(a, b, c) img2(a, b, c, (void (*)())FL_min2f, 0) |
Pixelwise Minimum of Two Images (Macro). More... | |
#define | and2(a, b, c) img2(a, b, c, (void (*)())FL_and2f, 0) |
Pixelwise AND of Two Images (Macro). More... | |
#define | or2(a, b, c) img2(a, b, c, (void (*)())FL_or2f, 0) |
Pixelwise OR of Two Images (Macro). More... | |
#define | xor2(a, b, c) img2(a, b, c, (void (*)())FL_xor2f, 0) |
Pixelwise XOR of Two Images (Macro). More... | |
#define | binarize(s, d, t, b, w) bin0(s, d, t, b, w, (void (*)())FL_SetBin_U8P_U8P) |
Binarizes the Image. More... | |
#define | PaintWhite(s, d, t, w) bin0(s, d, t, w, 0, (void (*)())FL_SetIfGE_U8P_U8P) |
Fills Pixel greater or equal than a Threshold with a Color. More... | |
#define | PaintBlack(s, d, t, b) bin0(s, d, t, b, 0, (void (*)())FL_SetIfLT_U8P_U8P) |
Fills Pixel smaller than a Threshold with a Color. More... | |
#define | AND_image(s, d, c) bin0(s, d, c, 0, 0, (void (*)())FL_AND_I8P_I8) |
AND's Image Pixel Values with a Constant Value. More... | |
#define | OR_image(s, d, c) bin0(s, d, c, 0, 0, (void (*)())FL_OR_I8P_I8) |
OR's Image Pixel Values with a Constant Value. More... | |
Functions in this group use only the input data at the same pixel position as the output, for example functions which add two image's grey values, or do an image binarisation.
Functions which output geometrc transformations of the input image can be found at pixelImageTransformation
#define binarize | ( | s, | |
d, | |||
t, | |||
b, | |||
w | |||
) | bin0(s, d, t, b, w, (void (*)())FL_SetBin_U8P_U8P) |
This Macro binarizes the given image, this means, if the pixel value is < t
, the resulting pixel will have the value given by b
, otherwise the value will be w
.
s | Source Image. |
d | Destination Image. |
t | Threshold. |
b | Grey Value for 'Black' Color. |
w | Grey Value for 'Brighter than or Equals Threshold' Color. |
binarize() is a macro which calls bin0() with basic function FL_SetBin_U8P_U8P() as an argument.
#define PaintWhite | ( | s, | |
d, | |||
t, | |||
w | |||
) | bin0(s, d, t, w, 0, (void (*)())FL_SetIfGE_U8P_U8P) |
This Macro sets pixel brighter than the threshold to a new color, i.e. if the pixel value is < t
, the pixel value is not changed, otherwise the value will be w
.
s | Source Image. |
d | Destination Image. |
t | Threshold. |
w | Grey Value for 'Brighter than or Equals Threshold' Color. |
PaintWhite() is a macro which calls bin0() with basic function FL_SetIfGE_U8P_U8P() as an argument.
#define PaintBlack | ( | s, | |
d, | |||
t, | |||
b | |||
) | bin0(s, d, t, b, 0, (void (*)())FL_SetIfLT_U8P_U8P) |
This Macro sets pixel darker than the threshold grey value to a new color, i.e. if the pixel value is < t
, the resulting pixel will have the value specified by b
, otherwise the value will not be changed.
s | Source Image. |
d | Destination Image. |
t | Threshold. |
b | Grey Value for 'Darker than Threshold' Color. |
PaintBlack() is a macro which calls bin0() with basic function FL_SetIfLT_U8P_U8P() as an argument.
#define AND_image | ( | s, | |
d, | |||
c | |||
) | bin0(s, d, c, 0, 0, (void (*)())FL_AND_I8P_I8) |
This Macro ANDs each pixel of the image provided by the constant value c
.
s | Source Image. |
d | Destination Image. |
c | Constant for ANDing. |
AND_image() is a macro which calls bin0() with basic function FL_AND_I8P_I8() as an argument.
#define OR_image | ( | s, | |
d, | |||
c | |||
) | bin0(s, d, c, 0, 0, (void (*)())FL_OR_I8P_I8) |
This Macro ORs each pixel of the image provided by the constant value c
.
s | Source Image. |
d | Destination Image. |
c | Constant for ORing. |
OR_image() is a macro which calls bin0() with basic function FL_OR_I8P_I8() as an argument.
#define add2 | ( | a, | |
b, | |||
c, | |||
sh | |||
) | img2(a, b, c, (void (*)())FL_add2f, sh) |
The macro calculates the pixelwise sum of two images. You can additionally change a shift value from no shift (= 0) to the desired shift value. The sign of the shift value provides the direction of the shift, e.g. sh
== 1 means sizing up values by multiplication with 2 (one shift operation step to the left), sh
== -2 divides the result values by 4 (shifts right for two steps). As formula:
Any parameter may be identical to any other, e.g. a
== c
.
add2() is a macro which calls img2() with basic function FL_add2f() as an argument.
#define sub2 | ( | a, | |
b, | |||
c | |||
) | img2(a, b, c, (void (*)())FL_sub2f, 0) |
#define subx2 | ( | a, | |
b, | |||
c, | |||
offs | |||
) | img2(a, b, c, (void (*)())FL_sub2x, offs) |
The pixelwise value of the difference of two images a
and b
is written to image c
after adding the offset offs
. If the value underruns 0 or exceeds 255 the value will be set to that value. As formula:
Any parameter may be identical to any other, e.g. a
== c
.
subx2() is a macro which calls img2() with basic function FL_sub2x() as an argument.
#define suby2 | ( | a, | |
b, | |||
c | |||
) | img2(a, b, c, (void (*)())FL_sub2y, 0) |
The pixelwise sign of the difference of two images a
and b
is encoded as 0 (bigger a
) or 255 (bigger b
) in image c
. If both values are equal the result value is set to 0. As formula:
Any parameter may be identical to any other, e.g. a
== c
.
suby2() is a macro which calls img2() with basic function FL_sub2y() as an argument.
#define mul2 | ( | a, | |
b, | |||
c, | |||
sh | |||
) | img2(a, b, c, (void (*)())FL_mul2f, sh) |
The macro calculates the pixelwise product of two images. You can additionally change a shift value from no shift (= 0) to the desired shift value. The sign of the shift value provides the direction of the shift, e.g. sh
== 1 means sizing up values by multiplication with 2 (one shift operation step to the left), sh
== -2 divides the result values by 4 (shifts right for two steps). As formula:
Any parameter may be identical to any other, e.g. a
== c
.
mul2() is a macro which calls img2() with basic function FL_mul2f() as an argument.
#define max2 | ( | a, | |
b, | |||
c | |||
) | img2(a, b, c, (void (*)())FL_max2f, 0) |
#define min2 | ( | a, | |
b, | |||
c | |||
) | img2(a, b, c, (void (*)())FL_min2f, 0) |
#define and2 | ( | a, | |
b, | |||
c | |||
) | img2(a, b, c, (void (*)())FL_and2f, 0) |
#define or2 | ( | a, | |
b, | |||
c | |||
) | img2(a, b, c, (void (*)())FL_or2f, 0) |
#define xor2 | ( | a, | |
b, | |||
c | |||
) | img2(a, b, c, (void (*)())FL_xor2f, 0) |
The function copies the contents of the image variable src
to dst
. If the format of the image variable (dx, dy) is not identical, the format of the result variable dst
is used. In particular, this means that the result of the operation is not defined if the image format of src
is smaller than that of dst
. ( src->dx < dst->dx or src->dy < dst->dy). You are recommended to work with identical image formats, i.e. src->dx = dst->dx and src->dy = dst->dy.
It is possible to copy the contents of any type of image, e.g. color images with this function. In this case, the copy is performed only, if src and dst belong to the same storage classes, i.e. require the same amount of memory and the same number of bits per pixel. I.e. a copy from type = IMAGE_RGB to IMAGE_IHS is allowed, whereas a copy from IMAGE_GREY to IMAGE_RGB is not allowed. It is recommended to use images of the same type for src and dst.
The function returns the standard error code.
The function copies the contents of the image variable src
to dst
. If the format of the image variable (dx, dy) is not identical, the format of the result variable dst
is used. In particular, this means that the result of the operation is not defined if the image format of src
is smaller than that of dst
. ( src->dx < dst->dx or src->dy < dst->dy). You are recommended to work with identical image formats, i.e. src->dx = dst->dx and src->dy = dst->dy.
It is possible to copy the contents of any type of image, e.g. color images with this function. In this case, the copy is performed only, if src and dst belong to the same storage classes, i.e. require the same amount of memory and the same number of bits per pixel. I.e. a copy from type = IMAGE_RGB to IMAGE_IHS is allowed, whereas a copy from IMAGE_GREY to IMAGE_RGB is not allowed. It is recommended to use images of the same type for src and dst.
The mask
bits define the bits which are overwritten (1) at the destination, others remain untouched (0).
The function returns the standard error code.
The function combines an image out of two others using a bit mask selector. If the format of the image variable (dx, dy) is not identical, the format of the result variable dst
is used. In particular, this means that the result of the operation is not defined if the image format of src0
or src1
is smaller than that of dst
. ( src?->dx < dst->dx or src?->dy < dst->dy). You are recommended to work with identical image formats, i.e. src?->dx = dst->dx and src?->dy = dst->dy.
It is possible to merge the contents of any type of image, e.g. color images with this function. In this case, the copy is performed only, if src0, src1, and dst belong to the same storage classes, i.e. require the same amount of memory and the same number of bits per pixel. I.e. a merge from type = IMAGE_RGB to IMAGE_IHS is allowed, whereas a copy from IMAGE_GREY to IMAGE_RGB is not allowed. It is recommended to use images of the same type for src0, src1, and dst.
The mask
bits define the origin of the bits which are written to the destination, for each bit which is zero the bit comes from src0
, for each bit which is one the bit comes from src1
.
The function returns the standard error code.
The function binarizes image src
and writes the result to dst
, which may be equal to src
. thr
is the threshold, blk
the grey value for the display of binary 'black', wht
the grey value for the display of binary 'white'. fc
is a function pointer to the basic binarisation function.
The following macros use this function:
Call | Operation | Basic function |
---|---|---|
binarize(s, d, t, b, w) | (pixel < t) ? b : w | FL_SetBin_U8P_U8P() |
PaintWhite(s, d, t, w) | (pixel < t) ? nc : w | FL_SetIfGE_U8P_U8P() |
PaintBlack(s, d, t, b) | (pixel < t) ? b : nc | FL_SetIfLT_U8P_U8P() |
OR_image(s, d, c) | pixel OR c | FL_OR_I8P_I8() |
remark: nc means "not changed"
Of course, you can write your own basic binarisation functions. Pass their address (function pointer) to bin0().
src | Source Image. |
dst | Destination Image. |
thr | Threshold. |
blk | Grey Value for 'black' color. |
wht | Grey Value for 'white' color. |
fc | Basic Function to perform Binarization. |
The function makes it possible to calculate any links of the two image variables a
and b
. The result is stored in the image variable c
, which can be identical with a
or b
or both. If the format of the image variables (dx
, dy
) is not identical for all three image variables, then the format of the result variable c
is used. In particular, this means that the result of the operation is not defined if the image format of a
or b
is smaller than that of c
. ( a->dx < c->dx or a->dy < c->dy or b->dx < c->dx or b->dy < c->dy). You are recommended to work with identical image formats, i.e. a->dx = b->dx = c->dx and a->dy = b->dy = c->dy. q
is a parameter which is passed to the basic function func(). The nature of the link is specified by providing a pointer to the basic function to be executed. For the available basic functions there are macros (define instructions), which make it easier to call the function.
The following macros are available and documented:
Call | Operation | Basic function |
---|---|---|
add2(a,b,c,sh) | c=(a+b)<<+/->>|sh| | FL_add2f() |
sub2(a,b,c) | c = abs(a-b) | FL_sub2f() |
subx2(a,b,c,offs) | c = clip(0,255,(a - b + offs)) | FL_sub2x() |
suby2(a,b,c) | c = (a - b)>0 ? 255 : 0 | FL_sub2y() |
mul2(a,b,c,sh) | c=(a*b)<<+/->>|sh| | FL_mul2f() |
max2(a,b,c) | c = max(a,b) | FL_max2f() |
min2(a,b,c) | c = min(a,b) | FL_min2f() |
and2(a,b,c) | c = a AND b | FL_and2f() |
or2 (a,b,c) | c = a OR b | FL_or2f() |
xor2(a,b,c) | c = a XOR b | FL_xor2f() |
Of course, you can write your own basic functions. Pass their address (function pointer) to img2().
a | First Source Image. |
b | Second Source Image. |
c | Result Image. |
(*func)() | Processing Function. |
q | Optional Parameter for Processing Function. |
In some cases, a grey image does not cover the complete range of grey values from 0 to 255. With this function the range can be expanded to ease the human interpretation of the image on a computer screen. First, maximum and minimum grey levels are calculated in the search image. The range between maximum and minimum is then expanded to values between 0 and 255 using a lookup table.
src | Source Image. |
dst | Destination Image. |
ERR_NONE | on Success. |
The function transforms the image variable src
with the aid of a look-up table function. The result of the operation is stored in image variable dst
, which may be identical to src
. table
is the transformation table, which must have been created beforehand. If the format of the image variable (dx
, dy
) is not identical, the minimum of the formats of the image variables src
and dst
is used. For example, src->dx = min( src->dx, dst->dx). In particular, this means that the result of the operation is not defined if the image format of src
is smaller than that of dst
( src->dx < dst->dx or src->dy < dst->dy).
A pixel with a value 0 <= x < 256 will be transformed into table
[x].
The function returns the standard error code.
src | Source Image. |
dst | Destination Image. |
table | Lookup Table with 256 Values. |
The function transforms the image variable src
with the aid of a false color look-up table function. The result of the operation is stored in image variable dst
, which must be of type IMAGE_RGB. red
, grn
and blu
are the transformation tables, which must have been created beforehand. If the format of the image variable (dx
, dy
) is not identical, the minimum of the formats of the image variables src
and dst
is used. For example, dx = min( src->dx, dst->dx). In particular, this means that the result of the operation is not defined if the image format of src
is smaller than that of dst
( src->dx < dst->dx or src->dy < dst->dy).
A pixel with a value 0 <= x < 256 will be transformed into a pseudo color.
The function returns the standard error code.
src | Source Image. |
dst | Destination Image. |
red | Lookup Table with 256 Values for red channel. |
grn | Lookup Table with 256 Values for green channel. |
blu | Lookup Table with 256 Values for blu channel. |
The function writes a false color lookup table at provided arrays. red
, grn
, blu
must at least have 256 entries.
A pixel with a value 0 <= x < 256 will be transformed into a pseudo color. The color change is as follows, starting at smallest value:
Black -> Red -> Yellow -> Green -> Cyan -> Blue -> Magenta.
red | Lookup Table with 256 Values for red channel. |
grn | Lookup Table with 256 Values for green channel. |
blu | Lookup Table with 256 Values for blu channel. |