# Morphology with line SE - MATLAB Sources

Here you will find the sources for some morphological filters with line segments as structuring elements, as presented in:

• C.L. Luengo Hendriks and L.J. van Vliet, Using line segments as structuring elements for sampling-invariant measurements, IEEE Transactions on Pattern Analysis and Machine Intelligence 27(11):1826-1831, November 2005.

These scripts are written for MATLAB with the DIPimage toolbox. The ZIP file below contains an M-file that implements the filters, as well as two M-files to reproduce our experiments:

• The MATLAB function LINE_SE applies one of the standard morphological operations (dilation, erosion, opening, closing) using a line segment as structuring element, with one of the following methods:
'discrete'
direct implementation with a discrete line segment
'recursive'
using the van Herk algorithm along Bresenhman lines
'soille'
using the intersection of closings / union of openings as described by Soille and Talbot, IEEE-PAMI, 23-11, 2001
'periodic'
using a periodic line, but not using a fast implementation
'interpolated'
using the van Herk algorithm along interpolated lines
'true_interpolated'
similar to 'interpolated', but without interpolating in the result of the morphological operation and using many more computations
'grey-value'
using a grey-value SE, consisting of a band-limited line segment
The line segment is defined by a length and an angle. See HELP LINE_SE for usage. The method as described by Soille and Talbot can be implemented in two ways: the angle can be "rounded" to obtain a finite periodicity or not. The method 'soille' finds such a finite periodicity by rounding the bounding box of the line segment. The method 'soille2' only changes the angle to obtain a discrete line. This second implementation does satisfy the absorption property, but typically takes a much longer running time.
• The function LINE_SE_COMPARISON produced the graphs that test the various methods for translation invariance. It will compute first and then produce a set of EPS files.
• The function LINE_SE_TIMING executes operations with the various methods for different values of the parameters length and angle, and different image sizes, timing them. The results are saved in a MAT file. That same function, called with an argument, will plot the resulting times in different ways for one of the methods (for example line_se_timing(4)).