7.3.13. Morphological Operation on Images of shorts
(lsh/libimage/morpho-short.lsh)


Erosion/dilation morphological operations on images of shorts.

CAUTION with the so-called "margin" parameter. a margin of 1 is sufficient in most cases, however the margin pixels MUST be filled with 0 (background/white) for the functions to work properly. ( dilero does it automatically).



7.3.13.0. (ubim-fillborder shim c)
(lsh/libimage/morpho-short.lsh)


fill a one-pixel border of the ubimage shim with value c . This function is useful for various morphological operations.

7.3.13.1. (shim-fillborder shim c)
(lsh/libimage/morpho-short.lsh)


fill a one-pixel border of the shimage shim with value c . This function is useful for various morphological operations.

7.3.13.2. (shim-dilation im margin)
(lsh/libimage/morpho-short.lsh)


((-idx2- (-short-)) im)  ;; image to be dilated:
((-int-) margin):
RETURNS:
CREATED: Y. LeCun, modified P.Haffner
COMPILABLE: Yes
DESCRIPTION:


7.3.13.3. (shim-erosion im oldim mode margin)
(lsh/libimage/morpho-short.lsh)


((-idx2- (-short-)) im)      ;; image to be eroded:
((-idx2- (-short-)) orig-im) ;; original image, only used in mode 2:
((-int-) mode):
((-int-) margin)  ;; erosion margin, typical values are 1 or 2:
RETURNS:
CREATED: Y. LeCun, modified P.Haffner
COMPILABLE: Yes
DESCRIPTION:
erosions with hexagonal tesselation
<dist> is an idx2 of shorts with dimensions identical to <im>+ border.
It will contain the distance transform on output.
<mode> shoul be 
                1 ==> erosion
                2 ==> erosion and hole restoration


7.3.13.4. (idx-s2xors2 m1 m2)
(lsh/libimage/morpho-short.lsh)


((-idx2- (-short-)) m1 m2):
RETURNS: (-idx2- (-short-)) m1x2
CREATED: P.Haffner
COMPILABLE: Yes
DESCRIPTION: performs a logical XOR betweem m1 and m2.
m1x2 pixel is 0 when m1 and m2 pixels are equal, 0 otherwise.


7.3.13.5. (dilero runs margin)
(lsh/libimage/morpho-short.lsh)


(-idx2- runs):
(-int- margin):
RETURNS: an -idx2- matrix of runs
CREATED: P.Haffner
COMPILABLE: Yes
DESCRIPTION:
morphological closing operator.
successively applies dilation and erosion functions
<margin> represents the extend of the initial dilation
- 0 nothing happens
- 1 using an hexagonal tesselation, all pixel next to  a black pixel becomes black.
- 2 distance is extended to two pixels.