The Guile-CV procedures and methods related to segmentation.
Returns two values: a new GRAY image or GRAY channel, and the total number of objects.
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
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
(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.
Here above, left being the original image, you can see the difference
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
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.
Here above, left being the original
tif image6, you can see the
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
all images displayed in the documentation are
png images, though
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
(which normalize all pixel values to [0 255].).
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