Guile-CV Reference Manual

Next:   [Contents][Index]

Guile-CV Reference Manual

This manual documents Guile-CV version 0.1.7.

Copyright (C) 2016 - 2017 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License.”


Table of Contents


Next: , Up: Top   [Contents][Index]

Preface

This manual describes how to use Guile-CV. It relates particularly to Guile-CV version 0.1.7.


Next: , Up: Preface   [Contents][Index]

Contributors to this Manual

Like Guile-CV itself, the Guile-CV reference manual is a living entity. Right now, the contributor to this manual is:

who is also the author and maintainer of Guile-CV.

You are most welcome to join and help. Visit Guile-CV web site to find out how to get involved.


Previous: , Up: Preface   [Contents][Index]

The Guile-CV License

Guile-CV is Free Software. Guile-CV is copyrighted, not public domain, and there are restrictions on its distribution or redistribution:

You must be aware there is no warranty whatsoever for Guile-CV. This is described in full in the license.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction


Next: , Up: Introduction   [Contents][Index]

1.1 About Guile-CV

GNU Guile-CV
Image Processing and Analysis in Guile
a Computer Vision functional programming library

Guile-CV - Image Processing and Analysis in Guile - is a Computer Vision functional programming library for the Guile Scheme language.

Based on Vigra (Vision with Generic Algorithms - a C++ image processing and analysis library), Guile-CV comprises a direct binding to Vigra C (a C wrapper to most of the Vigra functionality), enriched with pure Guile scheme algorithms, all accessible through a nice, clean and easy to use high level API.

Guile-CV is natively multi-threaded, and takes advantage of multiple cores, using high-level and fine grained application-level parallelism constructs available in Guile, based on its support to POSIX threads.

Objective

Guile-CV objective is to be a robust, reliable and fast - Image Processing and Analysis - Computer Vision functional programming library for the Guile Scheme language. Guile-CV also wants to be easy to use, study, modify and extend.

Guile-CV can be used as an educational sofware, a research toolbox but it can also be used 'in production': Guile-CV is robust, reliable and fast, and we will make sure Guile-CV remains robust, reliable and fast as it grows.

Savannah

Guile-CV also has a Savannah project page.


Next: , Previous: , Up: Introduction   [Contents][Index]

1.2 Obtaining and Installing Guile-CV

Guile-CV can be obtained from the following archive site. The file will be named guile-cv-version.tar.gz. The current version is 0.1.7, so the file you should grab is:

http://ftp.gnu.org/gnu/guile-cv/guile-cv-0.1.7.tar.gz

Dependencies

Guile-CV needs the following software to run:

Install from the tarball

Assuming you have satisfied the dependencies, open a terminal and proceed with the following steps:

cd <download-path>
tar zxf guile-cv-0.1.7.tar.gz
cd guile-cv-0.1.7
./configure [--prefix=/your/prefix]
make
make install

Special notes:

Before you start to use Guile-CV, make sure you read and implement the recommendation made in the manual, section See Configuring Guile's repl-print procedure.

Happy Guile-CV!

Install from the source

Guile-CV uses Git for revision control, hosted on Savannah, you may browse the sources repository here.

There are currently 2 [important] branches: master and devel. Guile-CV stable branch is master, developments occur on the devel branch.

So, to grab, compile and install from the source, open a terminal and:

git clone git://git.savannah.gnu.org/guile-cv.git
cd guile-cv
./autogen.sh
./configure [--prefix=/your/prefix]
make
make install

Special notes:

Before you start to use Guile-CV, make sure you read and implement the recommendation made in the manual, section See Configuring Guile's repl-print procedure.

The above steps ensure you’re using Guile-CV bleeding edge stable version. If you wish to participate to developments, checkout the devel branch:

git checkout --track -b devel origin/devel

Happy hacking!


Notes:

  1. In the above configure step, --prefix=/your/prefix is optional. The default value is /usr/local.

  2. To install Guile-CV, you must have write permissions to the following directories:

    $prefix and its subdirs
    Guile’s global site directory
    Guile’s site ccache directory

    You may check the above two latest directories location using:

    guile -c "(display (%global-site-dir)) (newline)"
    guile -c "(display (%site-ccache-dir)) (newline)"
    

    Guile-CV’s modules are installed in Guile’s global site directory. Guile-CV’s compiled modules are installed in the Guile’s site-ccache directory.

  3. Like for any other GNU Tool Chain compatible software, you may install the documentation locally using make install-info, make install-html and/or make install-pdf. The documentation is installed in $prefix/share/doc/guile-cv

  4. Last but not least :), Guile-CV comes with a test-suite, which we recommend you to run (especially before Reporting Bugs):
    make check
    

Next: , Previous: , Up: Introduction   [Contents][Index]

1.3 Contact

Mailing lists

Guile-CV uses the following mailing list:

When sending emails to guile-user and/or guile-devel, please use ’Guile-CV: ’ to prefix the subject line of any Guile-CV related email, thanks!

IRC

Most of the time you can find me on irc, channel #guile, #guix and #scheme on irc.freenode.net, #clutter and #introspection on irc.gnome.org, under the nickname daviid.


Previous: , Up: Introduction   [Contents][Index]

1.4 Reporting Bugs

Guile-CV uses the following bug reports mailing list:

You can (un)subscribe to the bugs report list by following instructions on the list information page.


Next: , Previous: , Up: Top   [Contents][Index]

2 Using Guile-CV

Guile-CV Reference Manual still is a mock-up: any help is more then welcome to improve this situation, thanks!


Next: , Up: Using Guile-CV   [Contents][Index]

2.1 Configuring Guile’s repl-print procedure

Guile’s repl-print procedure _must_ be modified before to start to use Guile-CV. The default Guile’s repl-print procedure calls (write val), which is inadequate for images, even very small images2.

Unfortunately, Guile does not provide a simple way for its users to modify its repl-print procedure, so, for now, there is no other way but ’getting your hands dirty’ here :), but no big deal either, here are the steps.

The module we need to modify is (system repl common), so let’s first figure out where it is on your system3:

guile
...
scheme@(guile-user)> (string-append (%package-data-dir) "/" (effective-version))
-|
$2 = "/opt2/share/guile/2.2"

The above returned value is an example of course, just proceed with the value returned by your system. So, the file we need to edit, in our example, is here:

/opt2/share/guile/2.2/system/repl/common.scm

Edit the above file and:

  1. Add the following module to the list of imported modules:
    #:use-module (ice-9 pretty-print)
    
  2. Search for the repl-print definition and, at the end of the procedure definition, replace:
    (write val)
    

    by

    (truncated-print val)
    

Save the file of course, and your good to play with Guile-CV.


Next: , Previous: , Up: Using Guile-CV   [Contents][Index]

2.2 Images used in Guile-CV’s documentation

All images used in Guile-CV’s documentation are distributed with the source and installed here:

$prefix/share/doc/guile-cv/images

All examples using im-load and im-save given in this manual, unless a full pathname is specified, assume that these images are available from the guile current working directory, see getcwd and chdir in Guile’s manual

Our best recommendation, at least to start with, is to create a working directory, such as mkdir $HOME/guile-cv/images, for example, and as you need them, copy the distributed images you are interested in.


Previous: , Up: Using Guile-CV   [Contents][Index]

2.3 Starting Guile-CV

Special note:

Before you start to use Guile-CV, make sure you read and implement the recommendation made in Configuring Guile's repl-print procedure

With the previous Images used in Guile-CV's documentation recommendations in mind, open a terminal and:

cd ~/guile-cv/images
guile
scheme@(guile-user)> ,use (cv)
scheme@(guile-user)> (im-load "sand.tif")
-|
$2 = (512 512 1 (#f32(125.0 128.0 124.0 118.0 108.0 75.0 76.0 # …)))

Or if you use Emacs which, coupled with Geiser absolutely rocks :-), then a typical session becomes:

fire Emacs
M-x cd
-|
Change default directory: ~/guile-cv/images

M-x run-guile
scheme@(guile-user)> ,use (cv)
scheme@(guile-user)> (im-load "sand.tif")
-|
$2 = (512 512 1 (#f32(125.0 128.0 124.0 118.0 108.0 75.0 76.0 # …)))

Note that to benefit from Emacs’s Tab completion mechanism, while typing image filenames, Emacs itself must be in that directory, hence the above first step M-x cd ...


Next: , Previous: , Up: Top   [Contents][Index]

3 API Reference


Next: , Up: API Reference   [Contents][Index]

3.1 API Overview

Guile-CV Low Level API

The Guile-CV low level API is ...

Guile-CV High Level API

Guile-CV will also provide a higher level API ...


Next: , Up: API Overview   [Contents][Index]

3.1.1 Naming Conventions

Vigra Funtions

Guile-CV low level API procedure names hat bind a Vigra function always start with vigra- ...

bluefox
->
redbear

Previous: , Up: API Overview   [Contents][Index]

3.1.2 Abreviations

In the table below we list respectively the abreviation ...


Next: , Previous: , Up: API Reference   [Contents][Index]

3.2 Guile-CV


Next: , Up: Guile-CV   [Contents][Index]

3.2.1 Image Structure and Accessors

The Guile-CV procedures and methods related to images data structure, creating, accessing and copying images.

Image Data Structure

A Guile-CV image is represented by a list containing the following elements:

(width height n-channel idata)

where idata is a list of n-channel elements, each element being a vector of (* width height) cells. More precisely, each element is an srfi-4 homogeneous numeric vector of 32 bit floats, called f32vector, knowing that f32 is the C type float.

The external representation (ie. read syntax) for idata vectors is #f32(…). As an example, a gray scale image of width 3 and height 2, initialized to 0.0 is represented by the following expression:

(3 2 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0)))

The n-channel is an integer >= 1, with no limit but the memory size. This said, most Guile-CV procedures and methods expect either GRAY scale (n-channel=1), or RGB (n-channel=3) images. For the later, the channels are Red, Green and Blue in that order.

Guile-CV provides usefull accessors for all these fields. However, very often, you will need them all, in which case your best friend is (ice-9 match), here is an example:

,use (cv)
(define image (im-make 4 3 3))
(match image
  ((width height n-chan idata)
   (match idata
     ((r g b)
      ... your code here ...))))

You will find many examples of such a ‘pattern’ in Guile-CV’s source code itself of course, along with some other ‘techniques’ that might be useful, so we invite you to read it, and if you do so: feedback, design and code review is more then welcome! This section describes what is in the module (cv idata).

Note that the (cv) module imports and re-exports, among may others, the public interface of (ice-9 match).

Procedures

im-make
im-make-channel
im-make-channels
im-copy
im-copy-channel
im-size_
im-width_
im-height_
im-n-channel_
im-channels_
im-channel
im-image?
im-binary?
im-gray?_
im-rgb?_
im-=?
im-list=?
im-ref
im-fast-ref
im-set!
im-fast-set!
im-channel-offset
im-fast-channel-offset
im-channel-ref
im-fast-channel-ref
im-channel-set!
im-fast-channel-set!
im-collect
Procedure: im-make width height n [value]
Procedure: im-make-channel width height [value]
Procedure: im-make-channels width height n [value]

Returns a new image, list of channels or channel.

Each channel is an srfi-4 homogeneous vector of 32 bit floats (f32vector), of width by height initialized to value. The default value is 0.0

Procedure: im-copy image
Procedure: im-copy-channel channel width height

Returns a new fresh copy of image or channel.

Method: im-size image

Returns the list of (width height n-channel)for image.

Method: im-width image
Method: im-height image
Method: im-n-channel image
Method: im-channels image
Procedure: im-channel image n

Returns, respectively the width, the height, n-channel, channels or the nth channel for image.

Procedure: im-image? image
Procedure: im-binary? image
Method: im-gray? image
Method: im-rgb? image

Returns #t if image is respectively a Guile-CV image, a BINARY (black and white), a GRAY scale or an RGB image.

Notes: (a) im-image? is a relatively ‘expensive’ operation and offered for debugging purposes, but it is not recommended to use ‘in production’; (b) because of the former, im-gray? and im-rgb? do _not_ check if image is a valid Guile-CV image, instead, they only check for n-channel=1 and n-channel=3.

Procedure: im-=? [precision] i1 i2 i3 …
Procedure: im-list=? images [precision]

Returns #t if i1 i2 i3 … or images are of the same size, have the same number of channels that all respectively contain the same values.

If the first argument for im-=? is a number, it is used as the precision to compare pixel values: 1.0e-4 is the default precision value.

Procedure: im-ref image i j [k]
Procedure: im-fast-ref image i j [k]

Returns the pixel value stored at position i and j of the image channel k. The default value for k is 0.

im-fast-ref does not check the validity of its arguments: use it at your own risk.

Procedure: im-set! image i j [k] value
Procedure: im-fast-set! image i j [k] value

Returns nothing.

Sets the pixel value stored at position i and j of the image channel k to value. The default value for k is 0.

im-fast-set! does not check the validity of its arguments: use it at your own risk.

Procedure: im-channel-offset i j width height
Procedure: im-fast-channel-offset i j width

Returns the channel offset for the i and j indices, based on the width and height of the channel.

This procedure converts the matrix indices i and j to a vector offset for a channel of size width and height.

im-fast-channel-offset does not check the validity of its arguments: use it at your own risk.

Procedure: im-channel-ref channel i j width height
Procedure: im-fast-channel-ref channel i j width

Returns the pixel value stored at position i and j of the channel of size width and height.

im-fast-channel-ref does not check the validity of its arguments: use it at your own risk.

Procedure: im-channel-set! channel i j width height value
Procedure: im-fast-channel-set! channel i j width value

Returns nothing.

Sets the pixel at position i and j of channel of size width and height to value.

im-fast-channel-set! does not check the validity of its arguments: use it at your own risk.

Procedure: im-collect what i1 i2 i3 …

Returns a list of what collected from i1 i2 i3

The valid what synbols are:

size
width
height
n-channel
channels
chan-0, gray, red
chan-1, green
chan-2, blue
chan-k (*)

(*): whith k being a valid channel indice, [0 (- n 1)].


Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.2 Kernel Structure and Accessors

The Guile-CV procedures and methods related to kernels data structure, creating and accessing kernels.

Kernel Data Structure

A Guile-CV kernel is represented by a list containing the following elements:

(width height kdata)

where kdata is a vector of (* width height) cells. More precisely, kdata is an srfi-4 homogeneous numeric vector of 64 bit floats, called f64vector, knowing that f64 is the C type double.

The external representation (ie. read syntax) for kdata vectors is #f64(…). As an example, the identity kernel of width 3 and height 3, initialized to 0.0 is represented by the following expression:

(3 3 #f64(0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0))

The kernel width and height can be different (kernels can be rectangular), but both width and height must be odd values.

Guile-CV provides useful accessors for kernel fields, however, if you need them all, just like for accessing image fields, your best friend is (ice-9 match), here is an example:

,use (cv)
(match kernel
  ((width height kdata)
   ... your code here ...))

Note that the (cv) module imports and re-exports, among may others, the public interface of (ice-9 match).

Guile-CV defines a few useful kernels, see kernel variables at the end of this section, that you both may want to use and reuse: it will be easier, if you need to do so, to define your own kernels reusing an existing one, see the (cv kdata) module.

Procedures

k-make
k-make-circular-mask
k-width
k-height
k-size
k-channel
kernel?
k-ref
k-fast-ref
k-set!
k-fast-set!
k-offset
k-fast-offset
k-display
Procedure: k-make width height [values #f] [norm #f]

Returns a new kernel.

The kdata value of this new kernel is an srfi-4 homogeneous numeric vector of 64 bit floats, f64vector, composed of width by height cells.

The optional values argument can be:

#f

kdata is initialized to the ‘identity’ kernel (all zeros except the center of the kernel, initialzed to 1)

a single value

all kdata cells are initialized using that single value

a list of values

a list of width by height values, used to initialzed kdata, in the order they are given

The optional norm argument can be:

#f

in this case, kdata is not normalized

#t

unless values would be #f, kdata is normalized using (reduce + 0 values)

a single value

all kdata cells are normalized using that value, which must be a number different from 0

When both values and norm are passed - which is mandatory if you want to pass norm (since these are optional arguments, as opposed to keyword arguments) - values must precede norm on the arguments list.

As an example, here is how to define a 3 x 3 normalized mean kernel:

,use (cv)
(k-make 3 3 1 #t)
-|
$2 = (3 3 #f64(0.1111111111111111 0.1111111111111111  # # # # …))
(k-display $2)
-|

    0.11111    0.11111    0.11111
    0.11111    0.11111    0.11111
    0.11111    0.11111    0.11111
Procedure: k-make-circular-mask radius [value 1] [norm #f]

Returns a new circular mask kernel.

The kdata value of this new kernel is an srfi-4 homogeneous numeric vector of 64 bit floats, f64vector, composed of width by height cells where width and height are equal and odd values determined by the procedure.

The mandatory radius argument must be a floating point number satisfying the following predicate: (float>=? radius 0.5).

The optional norm argument can be:

#f

in this case, kdata is not normalized

#t

kdata values are normalized using (* n value), where n is the number of non zero elements of the circular kernel mask being defined.

When both value and norm are passed - which is mandatory if you want to pass norm (since these are optional arguments, as opposed to optional keyword arguments) - value must precede norm on the arguments list.

To illustrate, here are the circular kernel masks of radius 0.5, 1, 1.5 respectively:

...
(for-each (lambda (i)
            (k-display (k-make-circular-mask i)
                       #:proc float->int))
  '(0.5 1.0 1.5))
-|

  0  1  0
  1  1  1
  0  1  0


  1  1  1
  1  1  1
  1  1  1


  0  0  1  0  0
  0  1  1  1  0
  1  1  1  1  1
  0  1  1  1  0
  0  0  1  0  0

To better illustrate, let’s define a bigger circular kernel mask, transform it to an image and im-show it:

...
(match (k-make-circular-mask 49)
  ((w h kdata) (list w h 1 (list (f64vector->f32vector kdata)))))
  -|
$6 = (99 99 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 # …)))
(im-show $6 'scale)

And you should see the following image4

circular-kernel-mask-49
Procedure: k-width kernel
Procedure: k-height kernel
Procedure: k-size kernel
Procedure: k-channel kernel

Returns, respectively, the width, the height, the list of width and height or the kdata for kernel.

Procedure: kernel? kernel

Returns #t if kernel is a Guile-CV kernel.

Procedure: k-ref kernel i j
Procedure: k-fast-ref kernel i j

Returns the value stored at position i and j of the kernel.

k-fast-ref does not check the validity of its arguments: use it at your own risk.

Procedure: k-set! kernel i j value
Procedure: k-fast-set! kernel i j value

Returns nothing.

Sets the value stored at position i and j of the kernel to value.

k-fast-set! does not check the validity of its arguments: use it at your own risk.

Procedure: k-offset i j width height
Procedure: k-fast-offset i j width

Returns the kernel offset for the i and j indices, based on the width and height of the kernel.

This procedure converts the matrix indices i and j to a vector offset for a kernel of size width and height.

k-fast-offset does not check the validity of its arguments: use it at your own risk.

Procedure: k-display image [#:proc #f] [#:port (current-output-port)]

Returns nothing.

Displays the content of kernel on port, applying proc to each kernel value.

,use (cv)
(k-display %k-laplacian)
-|
    0.37500    0.25000    0.37500
    0.25000   -2.50000    0.25000
    0.37500    0.25000    0.37500

Variables

%k-identity
%k-edge0
%k-edge1
%k-sharpen
%k-mean
%k-gaussian-blur0
%k-gaussian-blur1
%k-unsharp
%k-emboss
%k-laplacian
%k-prewitt-y
%k-prewitt-x
%k-sobel-y
%k-sobel-x

Notes: (a) the following kernels are merely offered as ‘didactic’ examples, some of these were used ‘in the old days’, but in most cases, you will find and prefer to use a ‘specific’ and ‘modern’ procedure that will give (much) better results, such as, im-gaussian-blur, im-gaussian-sharp, im-sharpen (a simple sharpening procedure), im-canny (edge detection) ... and (b) in order to make these definitions easier to read, we’ve added some spaces and newlines.

Variable: %k-identity
(k-display %k-identity #:proc float->int)
-|
  0  0  0
  0  1  0
  0  0  0
Variable: %k-edge0
(k-make 3 3
        '(  1  0 -1
            0  0  0
           -1  0  1  ))
Variable: %k-edge1
(k-make 3 3
        '(  0  1  0
            1 -4  1
            0  1  0  ))
Variable: %k-sharpen
(k-make 3 3
        '( -1  -1  -1
           -1   9  -1
           -1  -1  -1  ))
Variable: %k-mean
(k-make 3 3
        '(  1  1  1
            1  1  1
            1  1  1  )
        9)
Variable: %k-gaussian-blur0
(k-make 3 3
        '(  1  2  1
            2  4  2
            1  2  1  )
        16)
Variable: %k-gaussian-blur1
(k-make 5 5
        '(  1   4   6   4  1
            4  16  24  16  4
            6  24  36  24  6
            4  16  24  16  4
            1   4   6   4  1  )
        256)
Variable: %k-unsharp
(k-make 5 5
        '(  1   4    6   4  1
            4  16   24  16  4
            6  24 -476  24  6
            4  16   24  16  4
            1   4    6   4  1  )
        -256)
Variable: %k-emboss

Also called %k-compass or %k-directional, this kind of filter is useful to enhance edges in given directions. With a 3 x 3 kernel, one normally uses filters for 0, 45, 90 and 135 degrees. The various angles are obtained ‘rotating’ the positive and negative values to ‘align’ with the various directions.

(k-make 3 3
        '(  -2  -2   0
            -2   6   0
             0   0   0  ))
Variable: %k-laplacian

This is a variation of the more traditional Laplacian kernels, that are meant to enhance edges, in this case in an isotropic fashion (non-directional). This the implementation in the Vigra code and it atributes large weights to the diagonal pixels of the kernel. Nevertheless, the total weight is zero.

(k-make 3 3
        '(  0.375   0.25  0.375
            0.25   -2.5   0.25
            0.375   0.25  0.375  ))

Prewitt filtering

Variable: %k-prewitt-y

A 3 x 3 kernel which emphasizes horizontal edges by approximating a vertical gradient.

(k-make 3 3
        '(  1   1   1
            0   0   0
           -1  -1  -1  ))
Variable: %k-prewitt-x

A 3 x 3 kernel which emphasizes vertical edges by approximating an horizontal gradient.

(k-make 3 3
        '(  1  0  -1
            1  0  -1
            1  0  -1  ))

Sobel filtering

Filtering an image using a ‘Sobel filter’ requires a three steps approach: (1) filtering the image using the ‘Sobel y filter’, (2) dito using the ‘Sobel x filter’, and (3) combining the results to obtain ‘Sobel magnitude’: (sqrt (+ (sqrt sobel-y) (sqrt sobel-x)).

Variable: %k-sobel-y
(k-make 3 3
        '(  1   2   1
            0   0   0
           -1  -2  -1  ))
Variable: %k-sobel-x
(k-make 3 3
        '(  1   0  -1
            2   0  -2
            1   0  -1  ))

Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.3 Import Export

The Guile-CV procedures and methods to load, save and query file system images.

Procedures

im-load
im-save
im-size
im-width
im-height
im-n-channel
im-gray?
im-rgb?
Procedure: im-load filename

Returns a Guile-CV image.

Loads the image pointed by filename and returns a Guile-CV image. filename can either be a GRAY or an RGB image.

At this point, Guile-CV supports the following file formats: GIF, TIFF, JPEG, BMP, EXR, HDR, PNM (PBM, PGM, PPM), PNG, SunRaster, KHOROS-VIFF.

Procedure: im-save image filename [scale #f]

Returns #t.

Saves image in filename.

The optional scale argument can take the following values:

#f

pixel values are ‘clipped’: values < 0 are saved as 0, values > 255 are saved as 255, and otherwise are saved unchanged

#t

all pixel values are scaled5 to the [0 255] range

The type in which image is saved is determined by the filename extension, as in the folowing example:

(im-load "edx.png")
...
(im-save $4 "/tmp/edx.jpg")
Method: im-size filename

Returns the list of (width height n-channel)for filename.

Method: im-width filename
Method: im-height filename
Method: im-n-channel filename

Returns, respectively the width, the height and the n-channel for filename.

Method: im-gray? filename
Method: im-rgb? filename

Returns #t if filename is respectively a GRAY scale or an RGB image.


Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.4 Processing

The Guile-CV procedures and methods to process images.

Procedures

im-resize
im-resize-channel
im-rotate
im-rotate-channel
im-flip
im-flip-channel
im-invert
im-invert-channel
im-transpose
im-transpose-channel
im-normalize
im-normalize-channel
im-crop
im-crop-channel
im-crop-size
im-padd
im-padd-channel
im-padd-size
im-rgba->rgb
im-rgba->gray
im-rgb->gray
im-threshold
im-add
im-add-channel
im-subtract
im-subtract-channel
im-multiply
im-multiply-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-and
im-or
im-xor
im-complement
im-scrap
im-particles
im-particle-clean
Procedure: im-resize image new-width new-height [#:i-mode 'bilinear]
Procedure: im-resize-channel channel width height new-width new-height [#:i-mode 'bilinear]

Returns a new image or chanbnel resized to new-width, new-height.

The interpolation mode #:i-mode, can be one of:

none
bilinear
biquadratic
bicubic
? (fixme)
Procedure: im-rotate image angle [#:i-mode 'bilinear]
Procedure: im-rotate-channel channel width height angle [#:i-mode 'bilinear]

Returns a new image or channel rotated by angle.

The angle is in degrees: +/-[0.0 360.0].

It is neccessary, for rotations other than multiples of 90°, to recalculate the target coordinates, since after the rotation, they might be floats. The ’next neighbor’ interpolation possible modes, #:i-mode, are:

bilinear
biquadratic
bicubic
? (fixme)
Procedure: im-flip image plane
Procedure: im-flip-channel channel width height plane

Returns a new image or channel flipped according to the selected plane.

Valid flipping plane values are:

hori horizontal
vert vertical
both
Procedure: im-invert image
Procedure: im-invert-channel channel width height

Returns a new inversed image or channel.

Calculating the inverse of an image or a channel consist of applying the exponent function, expt, to all pixel values, raising them to the power of -1.

Procedure: im-transpose image
Procedure: im-transpose-channel channel width height

Returns a new tranposed image or channel.

Transposing an image or a channel consist of flipping it over its main diagonal. In the transposed result, switched in size, row values are the original column values and column values are the original row values.

Procedure: im-normalize image [#:value 255.0]
Procedure: im-normalize-channel channel width height [#:value 255.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.

Procedure: im-crop image left top right bottom
Procedure: im-crop-channel channel width height left top right bottom [#:new-w #f] [#:new-h #f]

Returns a new image, resulting of the crop of image at left, top, right and bottom.

Procedure: im-crop-size width height left top right bottom

Returns a list, (new-width new-height).

Given the original image width and height, this procedure checks that left, top, right and bottom are valid and return a list, (new-width new-height), otherwise, it raises an error.

Procedure: im-padd image left top right bottom [#:color '(0.0 0.0 0.0)]
Procedure: im-padd-channel channel width height left top right bottom [#:new-w #f] [#:new-h #f] [#:value 0.0]

Returns a new image or channel, respectively padding image or channel by left, top, right and bottom pixels initialized respectively to color or value. Note that when im-padd is called upon a GRAY image, color is reduced to its corresponding gray value:

(/ (reduce + 0 color) 3)
Procedure: im-padd-size width height left top right bottom

Returns a list, (new-width new-height).

Given the original image width and height, this procedure checks that left, top, right and bottom are >= 0 and return a list, (new-width new-height), otherwise, it raises an error.

Procedure: im-rgba->rgb image [#:bg '(0.0 0.0 0.0)]

Returns a new RGB image.

The RGBA image channels are first normalized. The new RGB channels are obtained by applying the following pseudo code algorithm:

R = (((1 - Source.A) * BG.R) + (Source.A * Source.R)) * 255.0
G = (((1 - Source.A) * BG.G) + (Source.A * Source.G)) * 255.0
B = (((1 - Source.A) * BG.B) + (Source.A * Source.B)) * 255.0
Procedure: im-rgba->gray image [#:bg '(0.0 0.0 0.0)]

Returns a new GRAY image.

This procedure is implemented as (im-rgb->gray (im-rgba->rgb image)).

Procedure: im-rgb->gray image

Returns a new GRAY image.

Procedure: im-threshold image threshold [#:bg 'black] [#:prec 1.0e-4]

Returns a new BLACK and WHITE image.

Valid #:bg values are '(black white), the default is black. If image is an RGB image, im-rgb->gray is first called.

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.

Method: im-add image val
Method: im-add i1 i2 i3 …
Method: im-add-channel channel width height val
Method: im-add-channel width height c1 c2 c3 …

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.

Method: im-subtract image val
Method: im-subtract i1 i2 i3 …
Method: im-subtract-channel channel width height val
Method: im-subtract-channel width height c1 c2 c3 …

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.

Method: im-multiply image val
Method: im-multiply i1 i2 i3 …
Method: im-multiply-channel channel width height val
Method: im-multiply-channel c1 w1 h1 c2 w2 h2 c3 w3 h3 …

Returns a new image or channel.

Performs the scalar multiplication of image with val or the 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.

Method: im-divide image val
Method: im-divide i1 i2 i3 …
Method: im-divide-channel channel width height val
Method: im-divide-channel c1 w1 h1 c2 w2 h2 c3 w3 h3 …

Returns a new image or channel.

The scalar method divides each pixel of image or channel by val.

Technically speaking, there is no such thing as matrix division. Dividing a matrix by another matrix is an undefined function. The closest equivalent is multiplying by the inverse of another matrix.

So, the matrix divide methods performs the linear algebra matrix multiplication of i1 or c1 by the inverse of i2 i3 … or c1 c2 c3 … recursively. The number of lines of the next image must equal the number of columns of the previous intermediate result.

Procedure: im-range image
Procedure: im-range-channel channel width

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.

Procedure: im-min image
Procedure: im-max image
Procedure: im-min-channel channel width
Procedure: im-max-channel channel width

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.

Procedure: im-map proc i1 i2 i3 …
Procedure: im-map-channel proc width height c1 c2 c3 …

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

Procedure: im-reduce image proc default
Procedure: im-reduce-channel channel proc default

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
Procedure: im-and i1 i2 i3 …
Procedure: im-or i1 i2 i3 …
Procedure: im-xor i1 i2 i3 …

Returns image if one argument only, otherwise, it returns a new image, as the result of computing the logical AND, OR or XOR of all images.

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, 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 i1 when it is > 0.0, otherwise, they are set to the corresponding pixel mean value of all other images.

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 pixel value, until all images passed in arguments have been processed6.

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!

emacs-1
Procedure: im-complement image

Returns a new image.

This procedure computes the mathematical complement of image, which for Guile-CV means that for each pixel of each channel, the new value is (- 255.0 pixel-value).

Procedure: im-scrap image val [#:pred <] [#:con 8] [#:bg 'black]

Returns a new image.

Scraping an image is the operation of removing objects of size val, according to con, bg and pred.

Using the above mentioned arguments, im-scrap first calls im-label using con and bg, then calls im-features. The area feature of each object is then compared to val using pred, and the object is eliminated if the result is #t.

Note that image must be a binary image.

Procedure: im-particles image features [#:clean #t]

Returns a list of images.

Each returned image is a ‘particle’, which is a subpart of image determined by its bounding box, given by the left top right bottom values of the corresponding ‘entry’ in features (see im-features for a complete description of a feature value list.

When #:clean is #t, which is the default, im-particle-clean is called upon each particle (see below for a description of the expected result).

Procedure: im-particle-clean particle

Returns a new image.

Cleaning a particle (which is an image) means detecting and removing any object(s) that is(are) not connected to the ‘particle’ itself.

This procedure is based on the property that in a ‘particle’, which is an (sub)image resulting from a im-crop based on the bounding box coordinates as returned by im-features, there precisely is one object that, if you call im-features upon particle, would have its bounding box coordinates being the entire particle. In other words, if you call im-particle-clean upon an image that is not a ‘particle’, the result will just be a black image.


Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.5 Features

The Guile-CV procedures and methods related to image features.

Procedures

im-features
Procedure: im-features image l-image [#:n-label #f]

Returns a list of features, one list for each labeled object - including the backgroud - in ascending order: the background always comes first (since it is labeled 0).

Notes: (a) image can either be an RGB or a GRAY image; (b) l-image is the ‘corresponding’ labeled image; (c) when used, the #:n-label optional keyword argument must be the total number of labeled objects from l-image.

The GRAY feature list values are:

area

The labeled object area in pixel

left top right bottom

The coordinates of the ‘bounding box’ labeled object7

mean-x mean-y

Also sometimes called the ‘centroid’, these are the average of the x and y coordinates of all of the pixels in the labeled object. These two coordinate values are floating points, representing the ‘mathematical position’ of the mean x and y values of the labeled object

min max mean std-dev

The minimum, maximum, mean and standard gray deviaton labeled object values

major-ev-x major-ev-y minor-ev-x minor-ev-y

Respectively the major and minor eigen vectors x and y normalized coordinates8: (= (sqrt (+ (expt x 2) (expt y 2))) 1)

major-axis minor-axis

Respectively the major and minor eigen values, optimized so that they actually correspond to major and minor radius of the ellipse covering the same area as the particle itself

angle

The angle of the major eigen vector axis, in degrees in the trigonometirc circle reference system

center-mass-x center-mass-y

The center of mass x and y coordinates

perimeter

The labeled object perimeter in pixels

skewness kurtosis

Respectively the skewness and the kurtosis of the labeled object

circularity aspect-ratio roundness

Respectively the circularity (/ (* 4 %pi area) (expt perimeter 2)), the aspect ratio (/ major-axis minor-axis) and the roundness (/ minor-axis major-axis) of the labeled object

The RGB feature list values are:

area

The labeled object area in pixel

left top right bottom

The coordinates of the labeled object (the corresponding GRAY feature footnote applies here too of course)

mean-x mean-y

Also sometimes called the ‘centroid’, these are the average of the x and y coordinates of all of the (red green blue) pixels in the labeled object. These two coordinate values are floating points, representing the ‘mathematical position’ of the mean x and y values of tha labeled object

min-r min-g min-b max-r max-g max-b mean-r mean-g mean-b std-dev-r std-dev-g std-dev-b

The minimum, maximum, mean and standard deviaton labeled object values of the red, green and blue channels

major-axis minor-axis

Respectively the major and minor eigen values, optimized so that they actually correspond to major and minor radius of the ellipse covering the same area as the particle itself

angle

The angle of the major eigen vector axis, in degrees in the trigonometirc circle reference system

center-mass-x center-mass-y

The center of mass x and y coordinates

perimeter

The labeled object perimeter in pixels

skewness-r skewness-g skewness-b kurtosis-r kurtosis-g kurtosis-b

Respectively the skewness and the kurtosis labeled object values of the red, green and blue channels

circularity aspect-ratio roundness

Respectively the circularity (/ (* 4 %pi area) (expt perimeter 2)), the aspect ratio (/ major-axis minor-axis) and the roundness (/ minor-axis major-axis) of the labeled object

Though we did not make it public, Guile-CV has an internal feature display procedure that you might be interested to (re)use, so here is an example of a GRAY feature list display:

scheme@(guile-user)> (im-load "pp-17-bf.png")
$2 = (85 95 3 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 …) …))
scheme@(guile-user)> (im-rgb->gray $2)
$3 = (85 95 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 # …)))
$4 = (0.0 251.0 128.0 8075)
scheme@(guile-user)> (im-threshold $3 136)
$5 = (85 95 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 # …)))
scheme@(guile-user)> (im-label $5)
$6 = (85 95 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 # …)))
$7 = 1
scheme@(guile-user)> (im-features $3 $6)
$8 = ((3780 0 0 84 94 43.19735336303711 45.65052795410156 0.0 # # …) #)
scheme@(guile-user)> ((@@ (cv features) f-display) (match $8 ((bg a) a)))

                     area : 4295 (pixels)
    left top right bottom : 0 0 84 94
            mean-x mean-y :  40.94622  48.18766
             min max mean : 137.00000 251.00000 233.94669
       standard deviation :  19.80314
            major ev x, y :   0.22270   0.97489
            minor ev x, y :   0.97489  -0.22270
        major, minor axis :  39.87575  34.28503 (radius)
                    angle :  77.13236 (degrees)
      center of mass x, y :  40.94622  48.18766
                perimeter : 367.74725
                 skewness :  -2.94312
                 kurtosis :   8.75887
              circularity :   0.39909
             aspect ratio :   1.16307
                roundness :   0.85980

As we mentioned above, f-diplay is defined in the (cv features) module, but it is not exported: in Guile, calling none exported procedure (which should not be ‘abused’) is done using the syntax @@ module-name binding-name, which in this example translates to (@@ (cv features) f-display).


Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.6 Filters

The Guile-CV procedures and methods to filter images.

Procedures

im-gaussian-blur
im-gaussian-blur-channel
im-gaussian-gradient
im-gaussian-gradient-channel
im-gaussian-sharp
im-gaussian-sharp-channel
im-sharpen
im-sharpen-channel
im-convolve
im-convolve-channel
Procedure: im-gaussian-blur image sigma
Procedure: im-gaussian-blur-channel channel width height sigma

Returns a new image or channel.

The new image or new channel is the result of the computation of the Gaussian blurring, also known as the Gaussian smoothing, by means of a convolution of image or channel with a 2D Gaussian function, where sigma is the standard deviation of the Gaussian distribution.

Procedure: im-gaussian-gradient image sigma
Procedure: im-gaussian-gradient-channel channel width height sigma

Returns a new image or channel.

The new image or new channel is the result of the computation of the strength of the first order partial derivatives by means of a convolution of image or channel with the first order derivative of a 2D Gaussian function, where sigma is the standard deviation of the Gaussian distribution.

Procedure: im-gaussian-sharp image factor scale
Procedure: im-gaussian-sharp-channel channel width height factor scale

Returns a new image or channel.

The new image or new channel is the result of the computation of the Gaussian sharpening: the procedure does (a) perform a Gaussian smoothing at the given scale to create a temporary image smooth and (b) blends image and smooth according to the formula (- (* (+ factor 1) image) (* smooth factor)).

Procedure: im-sharpen image factor
Procedure: im-sharpen-channel channel width height factor

Returns a new image or channel.

This procedure performs a ‘simple sharpening’ operation on image. It actually calls im-convolve with the following kernel:

            -1/16  -1/8  -1/16      0  0  0
( * factor  -1/8    3/4  -1/8  ) +  0  1  0
            -1/16  -1/8  -1/16      0  0  0

and uses mirror as the ‘out of bound strategy’.

Procedure: im-convolve image kernel [#:obs 'repeat]
Procedure: im-convolve-channel channel width height kernel k-width k-height [#:obs 'repeat]

Returns a new image or channel.

The new image or new channel is the result of the convolution of image using kernel. The kernel k-width and k-height values can be different, but they must be odd numbers, inferior to width and height respectively.

The optional keyword argument #:obs determines the ‘out-of-bound strategy’. Valid #:obs symbols are:

avoid

do not operate on pixels upon which (centering) the kernel does not fit in the image

clip

clip the kernel when operating on pixels upon which (centering) the kernel does not fit in the image (this is only useful if the kernel is >= 0 everywhere)

repeat

repeat the nearest pixels

mirror

mirror the nearest pixels

wrap

wrap image around (periodic boundary conditions)

zero

assume out-of-bound pixel values is 0.0

Kernel data structure, accessors, procedures and predefined kernels are all described in this node of the Guile-CV manual: Kernel Structure and Accessors.


Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.7 Morphology

The Guile-CV procedures and methods related to morphology.

Procedures

im-disc-erode
im-disc-erode-channel
im-disc-dilate
im-disc-dilate-channel
im-open
im-open-channel
im-close
im-close-channel
im-fill
im-fill-channel
im-delineate
im-delineate-channel
im-distance-map
im-distance-map-channel
Procedure: im-disc-erode image radius
Procedure: im-disc-erode-channel channel width height radius

Returns a new image or channel.

Performs the morpholgical erosion of image using a disc of a given radius. Here is an example:

(im-make 5 5 1 1.0)
-|
$2 = (5 5 1 (#f32(1.0 1.0 1.0 1.0 1.0 …)))
(im-set! $2 1 2 0.0)
(im-disc-erode $2 1)
-|
$3 = (5 5 1 (#f32(1.0 0.0 0.0 0.0 1.0 …)))
(im-display $2 #:proc inexact->exact)
-|
Channel 1
  1  1  1  1  1
  1  1  0  1  1
  1  1  1  1  1
  1  1  1  1  1
  1  1  1  1  1
(im-display $3 #:proc inexact->exact)
-|
Channel 1
  1  0  0  0  1
  1  0  0  0  1
  1  0  0  0  1
  1  1  1  1  1
  1  1  1  1  1
Procedure: im-disc-dilate image radius
Procedure: im-disc-dilate-channel channel width height radius

Returns a new image or channel.

Performs the morpholgical dilatation of image using a disc of a given radius. Here is an example:

...
-|
$13 = (11 11 1 (#f32(0.0 0.0 0.0 0.0 0.0 …)))
(im-disc-dilate $13 1)
-|
$14 = (11 11 1 (#f32(1.0 1.0 1.0 1.0 1.0 …)))
(im-display $13 #:proc inexact->exact)
-|
Channel 1
  0  0  0  0  0  0  0  0  0  0  0
  0  1  1  1  1  0  0  1  1  1  0
  0  1  1  1  1  0  0  1  1  1  0
  0  1  1  1  1  1  1  1  1  1  0
  0  1  1  1  1  1  1  1  1  1  0
  0  1  1  0  0  0  1  1  1  1  0
  0  1  1  0  0  0  1  1  1  1  0
  0  1  1  0  0  0  1  1  1  1  0
  0  1  1  1  1  1  1  1  0  0  0
  0  1  1  1  1  1  1  1  0  0  0
  0  0  0  0  0  0  0  0  0  0  0
(im-display $14 #:proc inexact->exact)
-|
Channel 1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  0  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  1  1
  1  1  1  1  1  1  1  1  1  0  0
  1  1  1  1  1  1  1  1  1  0  0
Procedure: im-open image
Procedure: im-open-channel channel width height

Returns a new image or channel.

FIXME.

Procedure: im-close image
Procedure: im-close-channel channel width height

Returns a new image or channel.

FIXME.

Procedure: im-fill image
Procedure: im-fill-channel channel width height

Returns a new image or channel.

FIXME.

Procedure: im-delineate image [#:threshold 10] [#:radius 2]
Procedure: im-delineate-channel channel width height [#:threshold 10] [#:radius 2]

Returns a new image or channel.

Also know as ‘Edge Enhancement’, this procedure performs the delineation of image, obtained by applying the following pseudo code algorithm:

;; with
;;   Min = (im-disc-erode image radius)
;;   Max = (im-disc-dilate image radius)
D = Max - Min
If D < threshold
  ;; not an edge
  output pixel = input pixel
  ;; it is an edge
  If (pixel – Min) < (Max – pixel)
    output pixel = Min
    output pixel = Max
sinter sinter-delin-t10-r2 sinter-delin-t25-r5

Here above, left being the original image - a small part of an optical microscope capture of a sinter sample - you can see the difference between im-delineate called with the default threshold and radius values, then called using #:threshold 25 and #:radius 5.

Procedure: im-distance-map image [#:bg 'black] [#:mode 'euclidean]
Procedure: im-distance-map-channel channel width height [#:bg 'black] [#:mode 'euclidean]

Returns a new image or channel.

Also know as ‘Distance Tranform’, this procedure performs the distance map of image, which consist of, for each background pixel, calculating its distance to the nearest object or contour. In the return new image or channel, all background pixels will be assigned the their distance value, all other pixels will be assigned to 0. Distances larger than 255 are labelled as 255.

The default backgroung pixel value is 'black, the optional #:bg keyword argument also accepts 'white.

The default distance map mode is ’euclidean. Other valid optional #:mode keyword argument are ’chessboard and ’manhattan.

t-cells t-cells-edm t-cells-mdm t-cells-cdm

Here above, left being the original image - a few cells - you can see the results obtained by calling im-distance-map using respectively the 'euclidean, 'manhattan and 'chessboard modes.


Next: , Previous: , Up: Guile-CV   [Contents][Index]

3.2.8 Segmentation

The Guile-CV procedures and methods related to segmentation.

Procedures

im-label
im-label-channel
im-label-all
im-label-all-channel
im-canny
im-canny-channel
Procedure: im-label image [#:con 8] [#:bg 'black]
Procedure: im-label-channel channel width height [#:con 8] [#:bg 'black]
Procedure: im-label-all image [#:con 8]
Procedure: im-label-all-channel channel width height [#:con 8]

Returns two values: a new GRAY image or GRAY channel, and the total number of objects.

The im-label and im-label-channel procedures label foreground objects in the binary image. In the new image or channel, 0.0 indicates a background pixel, 1.0 indicates that the pixel belongs to object number 1, 2.0 that the pixel belongs to object number 2, etc.

The im-label-all and im-label-all-channel procedures label all objects in the binary image, with no specific distinction for any background value. As a result, these two procedures will label not only the continuous background, if any, but also any hole(s). As an example, they are used by im-fill, defined in the module (cv morphology), which you may have a look at for a better understanding of how it works.

Two pixels belong to the same object if they are neighbors. By default the algorithm uses 8-connectivity to define a neighborhood, but this can be changed through the keyword argument #:con, which can be either 4 or 8.

pp-17-bf pp-17-bf-label pp-17-bf-label-all

Here above, left being the original image, you can see the difference between im-label (1 object) and im-label-all (6 objects). Note that we had to run im-threshold on the original image first (all labeling procedures take a binary image (or channel) as their mandatory argument), for the record, we used 128 as the threshold value.

Procedure: im-canny image [#:sigma 1.0] [#:threshold 0.0] [#:marker 255.0]
Procedure: im-canny-channel channel width height [#:sigma 1.0] [#:threshold 0.0] [#:marker 255.0]

Returns a new image or channel.

Detect and mark edges using a Canny Edge Detector algorithm: (a) compute the image Gaussian gradient using sigma, (b) remove edges whose strength is below threshold, then for all remaining edges, (d) remove the non-local maxima (edge thinning) and (e) set their intensity using marker.

edx edx-canny-s1.0-t0.0-m255.0 edx-canny-s1.0-t8.0-m255.0 edx-canny-s1.5-t8.0-m255.0 edx-canny-s1.0-t8.0-m96.0

Here above, left being the original tif image9, you can see the difference between im-canny called using the default values, then using #:threshold 8, and finally both #:sigma 1.5 and #:threshold 8. The last example is an illustration of the use of #:marker 96.010.


Previous: , Up: Guile-CV   [Contents][Index]

3.2.9 Utilities

Other Guile-CV procedures and methods utilities.

Procedures

im-compose
im-compose-channels
im-display
im-display-channel
im-histogram
im-show
Procedure: im-compose position alignment [#:color '(0 0 0)] img-1 img-2 …
Procedure: im-compose-channels position alignment channels widths heights [#:value '0.0]

Returns a new image or a new channel.

The valid position and alignment symbols are:

left right

top center bottom

above below

left center right

When used, the optional #:color keyword argument must come after the mandatory alignment argument and precede img-1, otherwise Guile will raise an exception. For RGB images, it is the color used to padd images passed in argument that are inferior, in width or height (depending on the position), to the biggest of them. For GRAY images, the #:color is reduced to its corresponding gray value:

(/ (reduce + 0 color) 3)

For the im-compose-channels procedure, the list of channels, widths and heights must be of equal length and equally ordered, so the nth element of widths and heights are the width and height of the nth element of channels. The optional #:value keyword argument is used to padd channels that are inferior, in width or height (depending on the position), to the biggest of them.

Procedure: im-display image [#:proc #f] [#:port (current-output-port)]
Procedure: im-display-channel channel width height [#:proc #f] [#:port (current-output-port)]

Returns nothing.

Displays the content of image or channel on port.

The optional #:proc keyword argument must either be #f, the default, or a procedure that accepts a single (32 bits float) argument. When #:proc is #f, im-display will use an internally defined procedure which formats its argument ‘à la octave’: nine positions, six decimals, all number aligned on the dot. any value >= 1000 is converted to use the exponential float notation. Here is an ‘hand made’ example:

...
$2 = (4 3 3 (#f32(0.0 1.0 2.0 3.0 4.0 5.0) ... ...)
scheme@(guile-user)> (im-divide $2 99)
$3 = (4 3 3 (#f32(10.1010103225708 0.010101010091602802 …) …))
scheme@(guile-user)> (im-set! $3 0 0 0 10000)
$4 = (4 3 3 (#f32(10000.0 0.010101010091602802 # # # # …) …))
scheme@(guile-user)> (im-display $4)
-|

Channel 1

     1.0E+4    0.01010    0.02020    0.03030
    0.04040    0.05051    0.06061    0.07071
    0.08081    0.09091    0.10101    0.11111

Channel 2

    0.12121    0.13131    0.14141    0.15152
    0.16162    0.17172    0.18182    0.19192
    0.20202    0.21212    0.22222    0.23232

Channel 3

    0.24242    0.25253    0.26263    0.27273
    0.28283    0.29293    0.30303    0.31313
    0.32323    0.33333    0.34343    0.35354

Caution: unless you specify port, both this and im-display-channel procedures are ment to be used on very small and testing images, otherwise even on a small image, it might be ok in a terminal, but it will definitely will kill your emacs.

Procedure: im-histogram image [#:subtitle “Untitled”]

Returns two values: (1) an image; (2) a list (or a list of list) of significant values for image: one list if image is GRAY, a list of list of values per channel if image is RGB.

The returned image is composed of a header (title, #:subtitle), either the GRAY or the RGB channel histogram(s) for image and a footer, which is a table containg, for each channel, the following values: mean, standard deviation, minimum, maximum, the mode11 followed by its value.

Here below, the call sequence and the histogram for the GRAY image sinter.png given along with Guile-CV documentation and examples:

scheme@(guile-user)> (im-load "sinter.png")
$32 = (212 128 1 (#f32(25.0 39.0 50.0 52.0 51.0 45.0 # …)))
scheme@(guile-user)> (im-histogram $32 #:subtitle "sinter.png")
$34 = (282 271 1 (#f32(255.0 255.0 255.0 255.0 255.0 # …)))
$35 = (27136 163.346 75.081 0 243 215 727)
sinter-histogram

Note that histogram images returned by im-histogram have no borders, the above histogram has been padded - using (im-padd $34 1 1 1 1 #:color '(96 96 96)) - for better readability, otherwise the title above and the table below would look as if they were not centered.

Method: im-show filename
Method: im-show image [scale #f]
Method: im-show image name [scale #f]

Returns the string "#<Image: …>", where "…" is either filename or a filename constructed by im-show, see below.

The optional scale argument can take the following values:

#f

pixel values are ‘clipped’: values < 0 are saved as 0, values > 255 are saved as 255, and otherwise are saved unchanged

#t

all pixel values are scaled12 to the [0 255] range

These three methods will also effectively dislay the image if you are using Geiser, which analyzes Guile’s procedures and methods returned values (through the use of its pattern matcher), and when appropriate, triggers its image display mechanism.

Geiser has two variables that allow you to choose either to inline images in its Emacs (Guile repl) buffer, or to display them using externel viewer: geiser-image-viewer and geiser-repl-inline-images-p. You may choose to add these variables in your .emacs file, for example:

(setq geiser-image-viewer "eog")
(setq geiser-repl-inline-images-p nil)

Note that (setq geiser-repl-inline-images-p t) will only work if you are using a graphics-aware Emacs, and otherwise, will fall on the external viewer approach, if the variable geiser-image-viewer has been defined. When using Geiser in a non graphics-aware Emac, or when using the external viewer approach, images will appear as buttons: press return on them to invoke (or raise) the external viewer (window containing that image).

Except for the first im-show method, Guile-CV has to save the image first, and does it in the location defined by the %image-cache variable. If you call im-show passing name, the image is saved as %image-cache/name.png, otherwise under a generated name, the result of (symbol->string (gensym "im-show-")).

Note that if you do not specify name, a new external viewer window is opened at each im-show invocation, even for identical image calls: this because in Guile-CV, on purpose, images are just list, with no (unique) identifier, and there is no way for im-show to know ... Further to this point, when you pass name as an argument, you are not ‘identifyingimage, which may actually differ, but rather just ask to reuse the filename and hence the external viewer window associated with it.

Last note: many external viewers, such as Eog (the Gnome Eye Viewer), will try to apply, per default, some sort of smoothing techniques, especially on zoom-in and zoom-out: where this is fine for viewing ‘lazer’ pictures, you probably want to check and disable these options when working with Guile-CV.

Variables

%image-cache
%image-cache-format
Variable: %image-cache

Specifies the location used by im-show to save images.

The default value is /tmp/<username>/guile-cv, but you may set! it. If you’d like to reuse that location for future guile-cv sessions, you may save it in guile-cv’s ‘per user’ config file <userdir>/.config/guile-cv as an assoc pair, here is an example:

cat ~/.config/guile-cv.conf
((image-cache . "~/tmp"))

Note that if used, the ‘~’ is expanded at load time, so in geiser, it becomes:

scheme@(guile-user)> ,use (cv)
scheme@(guile-user)> %image-cache
-|
$2 = "/home/david/tmp"
Variable: %image-cache-format

Specifies the format used by im-show to save images.

The default value is "png", but you may set! it. If you’d like to reuse that format for future guile-cv sessions, you may save it in guile-cv’s ‘per user’ config file <userdir>/.config/guile-cv, as an assoc pair, here is an example:

cat ~/.config/guile-cv.conf
((image-cache-format . "jpg"))

Previous: , Up: API Reference   [Contents][Index]

3.3 Support

Guile-CV uses a series of support modules, each documented in the following subsections. You may either import them all, like this (use-modules (cv support)), or individually, such as (use-modules (cv support modules)), (use-modules (cv support goops)), ...


Next: , Up: Support   [Contents][Index]

3.3.1 Modules

re-export-public-interface
Special Form: re-export-public-interface . args

Re-export the public interface of a module or modules. Invoked as (re-export-modules (mod1) (mod2)...).


Next: , Previous: , Up: Support   [Contents][Index]

3.3.2 Goops


Next: , Previous: , Up: Support   [Contents][Index]

3.3.3 G-export


Next: , Previous: , Up: Support   [Contents][Index]

3.3.4 Pi

Variables

%pi
%2pi
%pi/2
Variable: %pi
Variable: %2pi
Variable: %pi/2

Respectively bound to (acos -1), (* 2 %pi) and (/%pi 2).


Previous: , Up: Support   [Contents][Index]

3.3.5 Utils


Next: , Previous: , Up: Top   [Contents][Index]

Appendix A GNU Free Documentation License

Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
http://fsf.org/

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
  1. PREAMBLE

    The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

    This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

    We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

  2. APPLICABILITY AND DEFINITIONS

    This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

    A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

    A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

    The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

    The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

    A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.

    Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

    The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.

    The “publisher” means any person or entity that distributes copies of the Document to the public.

    A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.

    The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

  3. VERBATIM COPYING

    You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

    You may also lend copies, under the same conditions stated above, and you may publicly display copies.

  4. COPYING IN QUANTITY

    If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

    If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

    If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

    It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

  5. MODIFICATIONS

    You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

    1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
    2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
    3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
    4. Preserve all the copyright notices of the Document.
    5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
    6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
    7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice.
    8. Include an unaltered copy of this License.
    9. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
    10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
    11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
    12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
    13. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version.
    14. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section.
    15. Preserve any Warranty Disclaimers.

    If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.

    You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

    You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

    The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

  6. COMBINING DOCUMENTS

    You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

    The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

    In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”

  7. COLLECTIONS OF DOCUMENTS

    You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

    You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

  8. AGGREGATION WITH INDEPENDENT WORKS

    A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

    If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

  9. TRANSLATION

    Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

    If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

  10. TERMINATION

    You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.

    However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.

    Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.

    Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.

  11. FUTURE REVISIONS OF THIS LICENSE

    The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

    Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document.

  12. RELICENSING

    “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.

    “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.

    “Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.

    An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.

    The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.

ADDENDUM: How to use this License for your documents

To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

  Copyright (C)  year  your name.
  Permission is granted to copy, distribute and/or modify this document
  under the terms of the GNU Free Documentation License, Version 1.3
  or any later version published by the Free Software Foundation;
  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  Texts.  A copy of the license is included in the section entitled ``GNU
  Free Documentation License''.

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with…Texts.” line with this:

    with the Invariant Sections being list their titles, with
    the Front-Cover Texts being list, and with the Back-Cover Texts
    being list.

If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.


Next: , Previous: , Up: Top   [Contents][Index]

Concept Index

This index contains concepts, keywords and non-Schemey names for several features, to make it easier to locate the desired sections.

Jump to:   C   D   E   F   G   I   L   U  
Index Entry  Section

C
copying: Guile-CV License

D
Distance Transform: Morphology

E
Edge Detection: Segmentation
Edge Enhancement: Morphology

F
Features: Features

G
Gaussian blur: Filters
Gaussian gradient: Filters
Gaussian sharp: Filters
Gaussian smooth: Filters
GPL: Guile-CV License

I
Image convolution: Filters
Image decompose: Processing

L
license: Guile-CV License

U
User configuration: Utilities

Jump to:   C   D   E   F   G   I   L   U  

Next: , Previous: , Up: Top   [Contents][Index]

Procedure Index

This is an alphabetical list of all the procedures, methods and macros in Guile-CV.

Jump to:   I   K   R  
Index Entry  Section

I
im-=?: Image Structure and Accessors
im-add: Processing
im-add: Processing
im-add-channel: Processing
im-add-channel: Processing
im-and: Processing
im-binary?: Image Structure and Accessors
im-canny: Segmentation
im-canny-channel: Segmentation
im-channel: Image Structure and Accessors
im-channel-offset: Image Structure and Accessors
im-channel-ref: Image Structure and Accessors
im-channel-set!: Image Structure and Accessors
im-channels: Image Structure and Accessors
im-close: Morphology
im-close-channel: Morphology
im-collect: Image Structure and Accessors
im-complement: Processing
im-compose: Utilities
im-compose-channels: Utilities
im-convolve: Filters
im-convolve-channel: Filters
im-copy: Image Structure and Accessors
im-copy-channel: Image Structure and Accessors
im-crop: Processing
im-crop-channel: Processing
im-crop-size: Processing
im-delineate: Morphology
im-delineate-channel: Morphology
im-disc-dilate: Morphology
im-disc-dilate-channel: Morphology
im-disc-erode: Morphology
im-disc-erode-channel: Morphology
im-display: Utilities
im-display-channel: Utilities
im-distance-map: Morphology
im-distance-map-channel: Morphology
im-divide: Processing
im-divide: Processing
im-divide-channel: Processing
im-divide-channel: Processing
im-fast-channel-offset: Image Structure and Accessors
im-fast-channel-ref: Image Structure and Accessors
im-fast-channel-set!: Image Structure and Accessors
im-fast-ref: Image Structure and Accessors
im-fast-set!: Image Structure and Accessors
im-features: Features
im-fill: Morphology
im-fill-channel: Morphology
im-flip: Processing
im-flip-channel: Processing
im-gaussian-blur: Filters
im-gaussian-blur-channel: Filters
im-gaussian-gradient: Filters
im-gaussian-gradient-channel: Filters
im-gaussian-sharp: Filters
im-gaussian-sharp-channel: Filters
im-gray?: Image Structure and Accessors
im-gray?: Import Export
im-height: Image Structure and Accessors
im-height: Import Export
im-histogram: Utilities
im-image?: Image Structure and Accessors
im-invert: Processing
im-invert-channel: Processing
im-label: Segmentation
im-label-all: Segmentation
im-label-all-channel: Segmentation
im-label-channel: Segmentation
im-list=?: Image Structure and Accessors
im-load: Import Export
im-make: Image Structure and Accessors
im-make-channel: Image Structure and Accessors
im-make-channels: Image Structure and Accessors
im-map: Processing
im-map-channel: Processing
im-max: Processing
im-max-channel: Processing
im-min: Processing
im-min-channel: Processing
im-multiply: Processing
im-multiply: Processing
im-multiply-channel: Processing
im-multiply-channel: Processing
im-n-channel: Image Structure and Accessors
im-n-channel: Import Export
im-normalize: Processing
im-normalize-channel: Processing
im-open: Morphology
im-open-channel: Morphology
im-or: Processing
im-padd: Processing
im-padd-channel: Processing
im-padd-size: Processing
im-particle-clean: Processing
im-particles: Processing
im-range: Processing
im-range-channel: Processing
im-reduce: Processing
im-reduce-channel: Processing
im-ref: Image Structure and Accessors
im-resize: Processing
im-resize-channel: Processing
im-rgb->gray: Processing
im-rgb?: Image Structure and Accessors
im-rgb?: Import Export
im-rgba->gray: Processing
im-rgba->rgb: Processing
im-rotate: Processing
im-rotate-channel: Processing
im-save: Import Export
im-scrap: Processing
im-set!: Image Structure and Accessors
im-sharpen: Filters
im-sharpen-channel: Filters
im-show: Utilities
im-show: Utilities
im-show: Utilities
im-size: Image Structure and Accessors
im-size: Import Export
im-subtract: Processing
im-subtract: Processing
im-subtract-channel: Processing
im-subtract-channel: Processing
im-threshold: Processing
im-transpose: Processing
im-transpose-channel: Processing
im-width: Image Structure and Accessors
im-width: Import Export
im-xor: Processing

K
k-channel: Kernel Structure and Accessors
k-display: Kernel Structure and Accessors
k-fast-offset: Kernel Structure and Accessors
k-fast-ref: Kernel Structure and Accessors
k-fast-set!: Kernel Structure and Accessors
k-height: Kernel Structure and Accessors
k-make: Kernel Structure and Accessors
k-make-circular-mask: Kernel Structure and Accessors
k-offset: Kernel Structure and Accessors
k-ref: Kernel Structure and Accessors
k-set!: Kernel Structure and Accessors
k-size: Kernel Structure and Accessors
k-width: Kernel Structure and Accessors
kernel?: Kernel Structure and Accessors

R
re-export-public-interface: Modules

Jump to:   I   K   R  

Next: , Previous: , Up: Top   [Contents][Index]

Variable Index

This is an alphabetical list of all the important variables and constants in Guile-CV.

Jump to:   %
Index Entry  Section

%
%2pi: Pi
%image-cache: Utilities
%image-cache-format: Utilities
%k-edge0: Kernel Structure and Accessors
%k-edge1: Kernel Structure and Accessors
%k-emboss: Kernel Structure and Accessors
%k-gaussian-blur0: Kernel Structure and Accessors
%k-gaussian-blur1: Kernel Structure and Accessors
%k-identity: Kernel Structure and Accessors
%k-laplacian: Kernel Structure and Accessors
%k-mean: Kernel Structure and Accessors
%k-prewitt-x: Kernel Structure and Accessors
%k-prewitt-y: Kernel Structure and Accessors
%k-sharpen: Kernel Structure and Accessors
%k-sobel-x: Kernel Structure and Accessors
%k-sobel-y: Kernel Structure and Accessors
%k-unsharp: Kernel Structure and Accessors
%pi: Pi
%pi/2: Pi

Jump to:   %

Previous: , Up: Top   [Contents][Index]

Type Index

This is an alphabetical list of all the important data types defined in the Guile-CV Programmers Manual.


Footnotes

(1)

We do our best to check that the libvigra_c installed library does contain the required Guile-CV functionalty though, and these checks are listed as part of our configure steps

(2)

Even for very small images, using write is inadequate, in a terminal, and will definitely kill your Emacs/Geiser session. Not to mention it will raise your electricity bill :) - till you succeed to delete its process, Emacs will use one core at more then 100%, desperately trying to display hundreds of thousands of floating point values, heating your laptop (if you have a laptop) up to the point you’ll be able to cook an egg on it, and get its fans crasy... You’ve been warned :).

(3)

You need write privileges to modify this module, contact your admin if you’re not in charge of the system you are working on.

(4)

The 'scale optional argument passed to im-show, as its name indicate, is so that kernel values will be scaled, which in this case means that 1.0 values will become 255.0 - otherwise, it would be almost impossible for a human eye to actually see the shape of the circle …

(5)

Note that in this particular context, scale does not mean a change in dimension, but rather bringing pixel values from the range they occupy in memory to the [0 255] range

(6)

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

(7)

Note that when passed to im-crop, right and bottom must be increased by 1: (im-crop image left top (+ right 1) (+ bottom 1)).

(8)

Note that Vigra calculates and returns these values in the image coordinate system, where the y-axis is ‘flipped’ compared to the trigonometric circle ‘traditional’ representation. Guile-CV however transforms and returns these values using the trigonometric circle reference system.

(9)

Actually, all images displayed in the documentation are png images, though all described im-canny calls where performed on the original tif image. This is because in Guile-CV, all images are 32bit float images, and when saved as tif, all values are preserved (as opposed to being normalized): however, most viewers do not handle floating point pixel values (they don´t know how to scale the values, which may be negative, fractional...). In order to show the results in the documentation, even though all computations of this example were made upon the original tif image, they were saved to png (which normalize all pixel values to [0 255].).

(10)

Note that in order to show the result in the documentation, we had to manually set one pixel of one of the edges to 255.0: this is because, just as we explained in the previous footnote, to be able to display the image in the documentation, we had to save the image as png, which does normalize all values: if you do not set one of the pixels of one edge to 255.0, all markers values would be normalized to 255.0, there by loosing the original marker value.

(11)

The mode is the integer corresponding to the histogram entry that received the maximum of hits, and the value displayed in parens precisely is the number of hits.

(12)

Note that in this particular context, scale does not mean a change in dimension, but rather bringing pixel values from the range they occupy in memory to the [0 255] range