7.3.6. RGBA Images of floats
|
(lsh/libimage/rgbafimage.lsh) |
basic image processing on RGBA images where each pixel component is a
float.
7.3.6.0. rgbafimage
|
(lsh/libimage/rgbafimage.lsh) |
a rgbafimage is an idx3 of flts intended to store images. The last
dimension is 4, and contains the R, G, B, and Alpha channels
respectively.
7.3.6.1. (rgbafim-subsample in nlin ncol)
|
(lsh/libimage/rgbafimage.lsh) |
subsamples image in with integer
ratios nlin (vertical)
ncol (horizontal). the subsampled image is returned. The
horizontal (resp. vertical) size of the returned image is equal to the
integer part of the horizontal (resp vertical) size of
in divided by ncol (resp
nlin ).
7.3.6.2. (rgbafim-luminance in out)
|
(lsh/libimage/rgbafimage.lsh) |
compute luminance of each pixel and put result in image
out the formula used is lum = 0.299 * R + 0.587 * G + 0.114 *
B
7.3.6.3. (rgbafim-lum2rgba in out)
|
(lsh/libimage/rgbafimage.lsh) |
transform a grey-level image in (idx2
of flts) into an RGBA image. in and
out must have identical sizes, though no check of that is
done
7.3.6.4. (rgbafim-chromin-broken in z k out)
|
(lsh/libimage/rgbafimage.lsh) |
attempts to compute the chrominance info in in
(normalized colors with almost identical luminance) and put the result
in out . Both
in and out are idx3 of
flts. z is a multiplier for the
average pixel component value. k is a
fudge factor that prevents the normalisation from blowing up if the
color is black or almost black.
7.3.6.5. (rgbafim-chrominance in z k out)
|
(lsh/libimage/rgbafimage.lsh) |
attempts to compute the chrominance info in in
(normalized colors with almost identical luminance) and put the result
in out . Both
in and out are idx3 of
flts. z is a multiplier for the
average pixel component value. k is a
fudge factor that prevents the normalisation from blowing up if the
color is black or almost black.
7.3.6.6. (rgbafim-uvw in out)
|
(lsh/libimage/rgbafimage.lsh) |
transform an RGBA image into an UVWA image, where the V component
contains the luminance information, and the U and W components
collectively contain the chrominance information. In the UVW color
coding scheme the euclidean distance is meant to reflect the subjective
"perceptual" distance. See Digital Image Processing by W. Pratt, page
66.
7.3.6.7. (rgbafim-fromuvw in out)
|
(lsh/libimage/rgbafimage.lsh) |
converts back from UVWA to RGBA. It is advasable to saturate the
resulting image, as numerical errors may cause the pixel values to
exceed the range 0-255.
7.3.6.8. (rgbafim-saturate in min max out)
|
(lsh/libimage/rgbafimage.lsh) |
Saturate pixel component values in image in
to the range [ min ,
max ]. Result is put in out
.
7.3.6.9. (rgbafim-blit x y in out)
|
(lsh/libimage/rgbafimage.lsh) |
blit in into
out at position x ,
y with alpha blending. an alpha value of 0 in
in means opaque, 255 means totally transparent.
7.3.6.10. (rgbafim-blitcolor x y in r g b out)
|
(lsh/libimage/rgbafimage.lsh) |
blit color defined by r ,
g , b using idx2
in as a stencil into RGBA image out
at position x y
The values in in must be between 0 and
255. if the value is 255, no paint is put in; if the value is 0, the
pixel takes the value specified by r ,
g , b .
7.3.6.11. (rgbafim-init-lum2rgb )
|
(lsh/libimage/rgbafimage.lsh) |
build a table of 32x32x32 elements containing RGB cell indices in
ascending luminosity.
7.3.6.12. (rgbafim-lum2rgb n)
|
(lsh/libimage/rgbafimage.lsh) |
converts a luminosity index to a 5-bit RGB cell number.
7.3.6.13. (rgbafim-histo32 rgbafim ppal count)
|
(lsh/libimage/rgbafimage.lsh) |
compute histogram of image rgbafim .
ppal must be a 32768 by 3 matrix which will contain the list
of pixel values found. count must be a
32768 matrix which will contain the corresponding pixel counts. pixel
colors are sorted by luminance. This function really computes a 32768
color palette by assigning each pixel to the cube it belongs to in the
32x32x32 RBG color cube. The color prototype assigned to each cube is
the mean of the pixels belonging to the cube.
7.3.6.14. (rgbafim-interpolate-bilin background pin indimi indimj inmodi inmodj ppi ppj rez)
|
(lsh/libimage/rgbafimage.lsh) |
(-gptr- pin rez background):
(-int- indimi indimj inmodi inmodj ppi ppj):
SIDE EFFECTS: <rez>
AUTHOR: Y. LeCun
COMPILABLE: Yes
DESCRIPTION:
returns a bilinearly interpolated RGBA pixel value for coordinate
<ppi> <ppj>. The image data is pointed to by <pin>, with
<indimi> <indimj> <inmodi> <inmodj> being the dimensions and modulos.
This function clips automatically if <ppi> <ppj> are outside of the
bounds by assuming the outside values are equal to <background>.
pixel values are flts, while coordinates are 32 bit fixed point
with 16 bit integer part and 16 bit fractional part.
7.3.6.15. (rgbafim-warp in out background pi pj)
|
(lsh/libimage/rgbafimage.lsh) |
((-idx1- (-flt)) background):
((-idx3- (-flt-)) in out):
((-idx2- (-int-)) pi pj):
RETURNS: Null
SIDE EFFECTS: <out>
AUTHOR: Y. LeCun
COMPILABLE: Yes
DESCRIPTION:
Warps an image using <pi> and <pj> as tabulated coordinate transforms.
<in> and <out> are idx2 of flts. <background> is the value assumed outside
of the input image. <pi> and <pj> are tabulated coordinates which can
be filled up using compute-bilin-transform or similar functions.
Pixel values are antialiased using bilinear interpolation.
7.3.6.16. (rgbafim-warp-fast in out background pi pj)
|
(lsh/libimage/rgbafimage.lsh) |
((-int-) background):
((-idx2- (-flt-)) in out):
((-idx2- (-int-)) pi pj):
RETURNS: Null
SIDE EFFECTS: <out>
AUTHOR: Y. LeCun
COMPILABLE: Yes
DESCRIPTION:
Warps an image using <pi> and <pj> as tabulated coordinate transforms.
<in> and <out> are idx2 of flts. <background> is the value assumed outside
of the input image. <pi> and <pj> are tabulated coordinates which can
be filled up using compute-bilin-transform or similar functions.
This is essentially identical to warp-rgbafimage, except no antialiasing
is performed (it goes a lot faster, but is not nearly as nice).
7.3.6.17. (rgbafim-warp-quad in out background mode x1 y1 x2 y2 x3 y3 x4 y4 p1 q1 p3 q3)
|
(lsh/libimage/rgbafimage.lsh) |
((-flt-) x1 y1 x2 y2 x3 y3 x4 y4 p1 q1 p3 q3):
((-int-) background mode):
((-idx2- (-flt-)) in out):
RETURNS: Null
SIDE EFFECTS: <out>
AUTHOR: Y. LeCun
COMPILABLE: Yes
DESCRIPTION:
transforms rgbafimage <in> (idx2 of flt) mapping quadrilateral <x1> <y1> <x2>
<y2> <x3> <y3> <x4> (points are numbered clockwise starting from upper left)
to rectangle whose upper left and lower right points are <p1><q1>, <p3><q3>.
result is put in <out> (idx2 of flt). Clipping is automatically performed.
pixels outside of the bounds of <in> are assumed to have the value
<background>. <mode>=0: no antialiasing, <mode>=1: antialiasing with
bilinear interpolation (2 times slower). execution time on sparc 10 is about
5 ms in mode 0 and 10 ms in mode 1 for a 32x32 target image.