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-holes
im-fill-holes-channel
im-delineate
im-delineate-channel
im-distance-map
im-distance-map-channel
im-reconstruct
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 dilation 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 radius
Procedure: im-open-channel channel width height radius

Returns a new image or channel.

Performs the dilation of the erosion of image using radius. Opening removes small objects.

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

Returns a new image or channel.

Performs the erosion of the dilation of image using radius. Closing removes small holes.

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

Returns a new image or channel.

The argument must be a BINARY image. As its name indicate, this procedure fill the holes of all and every objects in the image.

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

Procedure: im-reconstruct image seeds [#:con 8]

Returns a new image.

This procedure implements a ‘binary morphological reconstruction’ algorithm, which extracts the connected components of image that are ‘marked’ by (any of) the connected components contained in seeds.

Morphological reconstruction is part of a set of image operators often referred to as ‘geodesic’ (geodesic distance, geodesic dilation …). Morphological (or geodesic) operations upon digital images come from and use the Mathematical morphology (MM) theory and technique developed for the analysis and processing of geometrical structures.

First described here11, this implementation is based on a revision of the same article published in ‘the IEEE Transactions on Image Processing, Vol. 2, No. 2, pp. 176-201, April 1993’, available here.


Footnotes

(11)

in Serra, Jean and Vincent, Luc (1992), "An overview of morphological filtering", Circuits, Systems and Signal Processing (Springer) 11 (1): 47-108


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