- See also
- opals::IEdgeDetect
Aim of module
Provides different raster based edge detection algorithms (e.g. Canny).
General description
The aim of opalsEdgeDetect is to provide an interface for different edge detectors. Based on an input raster file and an appropriate set of parameters for the respective edge detection algorithm, a binary output raster is derived containing the detected edge pixels.
- See also
- Module EdgeDetect
Module EdgeDetect is implemented using the OPALS modules Convolution and Algebra. Please note, that currently only Canny edge detection is implemented.
Canny algorithm
A comprehensive description of the Canny edge detection can be found here. In a nutshell, the Canny algorithm consists of the following steps:
-
Calculation of gradient in two orthogonal directions (based on the first derivative of Gaussian operator, Gx and Gy).
-
Non-maximum suppression (resulting in 1-pixel-edge lines)
-
Application of upper and lower threshold.
-
Edge tracking by hysteresis. Starting with pixels exhibiting gradients > upper threshold, the edges are extended (in both directions) until the gradient falls below the lower threshold. Finally, weak edges which are not connected to strong edges, are removed.
Implementation details
Please note, that while the Canny algorithm is a generic edge detector, the main application in the context of OPALS is to detect topographic breaklines (i.e. surface slope disontinuities like dams, ridges, ditches, embankments...). In this special case, a slope raster (pixel value = surface gradient in degree) turned out to be the best choice (c.f. Mandlburger et al., 2016).
Parameter description
-inFileinput raster file
Type:
opals::Path
Remarks: mandatory
The input raster image in GDAL supported format,
-outFileoutput raster file
Type:
opals::Path
Remarks: estimable
Path of (binary) raster image file in GDAL supported format containing edge pixels.
Estimation rule: The current directory and the name (body) of the input file are used as file name basis. Additionally, the postfix '_edge' and the output format extension are appended (e.g. '_edge.tif').
-oFormatraster file format [GTiff,EHdr...]
Type:
opals::String
Remarks: estimable
Use GDAL driver names like GTiff, EHdr... . It is recommended to use output formats supporting a binary (0|1) data type.
Estimation rule: The output format is estimated based on the extension of the output file (*.tif->GTiff, *.bil->EHdr, *.dtm->SCOP...).
-detectoredge detection method
Type:
opals::EdgeDetector
Remarks: default=Canny
Please note, that currently only the Canny edge detection is implemented.
-sigmaSmoothgaussian smoothing sigma
Type: float
Remarks: default=1
The standard deviation of the gaussian function for smoothing gradient computation using first-derivative of gaussian function. the value should be a positive number larger than 0.25.The kernel radius is three times parameter's value.
-thresholdthreshold values
Type:
opals::Array<double, 2>
Remarks: default=2 10
Depending on the edge detection methods, different threshold values are required. Canny: upper/lower threshold. The upper threshold denotes the minimum gradient necessary to start an edge. Starting from such an feature pixel the edge is extended in both directions until the gradient falls below the lower threshold.
-tempDirectorypath for intermediate files
Type:
opals::Path
Remarks: estimable
Directory path for storing intermediate files (gradient and exposition images, etc.).
Estimation rule: Current working directory + '/tempEdgeDetect'
-debugOutFileindicator for preserving temporary products
Type: bool
Remarks: default=0
If activated, all intermediate products (gradient and exposition images, etc.) are preserved. Otherwise, the entire temporary directory (-tempDirectory) is deleted at program termination.
-limit2D clipping window
Type:
opals::GridLimit
Remarks: optional
If no user defined limits are specified or -limit is even skipped, the entire xy-extents of the input raster model are used.
GridLimit: Defines xy-limits for output grid/raster datasets. The limit coordinates specified by left/lower/right/upper either refer to pixel centers (default) or corners, and may optionally get rounded to multiples of the grid size.
Syntax: ['center'|'corner']['round']['(' left lower right upper ')'] -noDatanodata value indicating void pixels
Type:
opals::NoDataType
Remarks: optional
Value representing an undefined value in the output grid model.
NoDataType: Defines or disables (use 'none') the nodata value for the output raster. The nodata values can be a specific value or a type independent label, such as, 'min', 'max' and 'nan'. Those labels will be translate to values based on the raster band type. See the OPALS Docu (opals::NoDataType) for more Details.
Syntax: none | min | max | nan | <value>
Short examples
Generate a Edge from DTM file
opalsGrid -inf flyover.odm -outf flyover_dtm.tif
Examples
The data used in the following examples can be found in the $OPALS_ROOT/demo/
directory. As a prerequisite, please use the following commands to generate a DTM from the ALS ground points stored in dataset flyover.laz
.
Now we can use Module EdgeDetect to detect the approximate 2D course of break lines from the resulting DTM slope raster. We specify the input grid (slope raster), the resulting binary raster image file containing the edge pixels, the kernel radius for gaussian smoothing, and the lower and upper threshold.
effects of smoothing on the edge detection result
parameter sigmaSmooth=0.5
parameter sigmaSmooth=1
parameter sigmaSmooth=1.5
parameter sigmaSmooth=2
References
-
Canny, J., A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8(6):679–698, 1986.
-
G. Mandlburger, J. Otepka, C. Briese, W. Mücke, G. Summer, N. Pfeifer, S. Baltrusch, C. Dorn, H. Brockmann: Automatische Ableitung von Strukturlinien aus 3D-Punktwolken. in: Publikationen der Deutschen Gesellschaft für Photogrammetrie, Fernerkundung und Geoinformation e.V., Band 25 (2016), ISSN: 0942-2870; 131 - 142.
- Author
- gm,paryan
- Date
- 8.1.2017