Next: Transform, Previous: Filter, Up: Image Processing [Contents][Index]
The Guile-CV procedures and methods to process images.
im-threshold
im-scrap
im-add
im-add-channel
im-subtract
im-subtract-channel
im-mtimes
im-mtimes-channel
im-times
im-times-channel
im-divide
im-divide-channel
im-range
im-range-channel
im-min
im-min-channel
im-max
im-max-channel
im-map
im-map-channel
im-reduce
im-reduce-channel
im-normalize
im-normalize-channel
im-and
im-and-channel
im-or
im-or-channel
im-xor
im-xor-channel
Returns a new BLACK and WHITE image.
The image argument can either be a GRAY or an an RGB image, in
which case each pixel is converted to GRAY as it is processed. Valid
#:bg values are black
(the default) and white
.
Pixels for which the original value is >=
threshold are set
to 255.0 if #:bg is 'black
, and set to 0.0 if #:bg is
'white
. The other pixels are set to 0.0 or 255.0 respectively.
Returns a new image.
Scraping an image is the operation of removing objects depending on their size (in pixels). When exclude-on-edges is #t, all objects that are on any edges are also removed.
The procedure first calls im-label using con and bg,
then calls im-features. The area
feature of each object is
then compared to size using pred and the object is removed
if the result is #t.
Note that image must be a binary image.
Returns a new image or channel.
Performs the scalar addition of image with val or the matrix addition of i1 i2 i3 … or c1 c2 c3 … respectively.
Returns a new image or channel.
Performs the scalar subtraction of image with val or the matrix subtraction of i1 i2 i3 … or c1 c2 c3 … respectively.
Returns a new image or channel.
Performs the scalar multiplication of image with val or the element by element multiplication of i1 i2 i3 … or c1 c2 c3 … respectively.
Returns a new image or channel.
Performs matrix multiplication of i1 i2 i3 … or c1 w1 h1 c2 w2 h2 c3 w3 h3 … recursively. The number of lines of the next image must equal the number of columns of the previous intermediate result.
Returns a new image or channel.
Performs the scalar division of image with val or the element by element division of i1 i2 i3 … or c1 c2 c3 … respectively.
It is the user responsibility to insure that none of the c2 c3
… values is zero
.
Returns a new image or channel.
Performs the matrix multiplication of i1 or c1 by the inverse of i2 i3 … or c2 c3 … recursively. The number of lines of the next image must equal the number of columns of the previous intermediate result19.
It is the user responsibility to insure that none of the c2 c3
… values is zero
.
Returns a list of six values (min row col max row col)
if
image is GRAY, and a list of list of these values if image
is RGB or for any n-chan > 1
images.
Returns three multiple values if image is GRAY: min row col
or max row col
respectively. If image is RGB or for any
n-chan > 1
images, it returns a list of list of these values.
Returns a new image or channel.
Apply proc to each pixel value of each channel of i1 (if only two arguments are given), or to the corresponding pixel values of each channels of i1 i2 i3 … (if more than two arguments are given).
Returns one value if image is GRAY. If image is RGB or for
any n-chan > 1
, it returns a list of values.
If image is empty, im-reduce
returns default (this is
the only use for default). If image has only one pixel, then the
pixel value is what is returned. Otherwise, proc is called on the
pixel values of image.
Each proc call is (proc elem prev)
, where elem
is a
pixel value from the channel (the second and subsequent pixel values of
the channel), and prev
is the returned value from the previous
call to proc. The first pixel value - for each channel - is the
prev
for the first call to proc
.
For example:
,use (cv) (im-load "edx.png") -| $2 = (128 128 1 (#f32(4.0 26.0 102.0 97.0 58.0 10.0 9.0 21.0 # …))) (im-reduce $2 + 0) -| $3 = 556197.0
Returns a new normalized image or channel.
Normalizing an image or a channel consist of dividing all
pixels by a value so they all fall in the [0.0 -> 1.0]
range. The
default #:value is 255.0
.
Returns image if one argument only, otherwise, it returns a new
image or channel, as the result of computing the logical AND
,
OR
or XOR
of all images or channels.
In the case of AND
, for all positive results, the pixel values
(of each channel) of the new image are set to the one obtained from
i1 or c1 respectively, and 0.0
otherwise.
In the case of OR
, the pixel values (of each channel) of the new
image are set to the one obtained from the first non zero ii or
ci respectively, otherwise it is set to 0.0
.
In the case of XOR
, the pixel values (of each channel) of the new
image are set to the value obtained from successively computing
(logior (logand a (- 255 b)) (logand (- 255 a) b))
where a
would be the previous result and b
the current image
or
channel
pixel value, until all images passed in arguments have
been processed20.
All images must have the same width
, height
and
n-channel
.
There are, of course, scientific use and examples of images logical
XOR
, and that is why Guile-CV is being
developed for, but let’s have a bit of fun here, and see if our
levitating GNU likes apples!
Technically speaking, there is no such thing as matrix division. Dividing a matrix by another matrix is an undefined function. The closest equivalent is to multiply the matrix by the inverse of the other matrix.
Note that there is no mathematically valid
XOR
operation on floating points, hence as they are
‘accessed’, pixel values are converted to integer, using
float->int
, defined in the (cv support libguile-cv)
module).
Next: Transform, Previous: Filter, Up: Image Processing [Contents][Index]