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]