smooth grain boundaries but keep genuine corners sharp
Description
Same variational idea as curvatureFilter, but the curvature is penalized by a Huber function instead of a square
|V - V0|^2 + alpha * sum rho(|L V|)with rho quadratic below a threshold and linear above it. Quadratic means least squares, which spreads a large deviation over many vertices and so rounds a corner off. Linear - an l^1 penalty - is minimized by concentrating the deviation in as few vertices as possible, which leaves a corner standing.
So the filter smooths gentle undulations exactly like curvatureFilter, while a boundary that is genuinely faceted keeps its facets and its corners. The threshold says how sharp a turn has to be to count as a corner rather than as noise.
The Huber problem is solved by iteratively reweighted least squares: the l^1 part is replaced by a quadratic with weight threshold/|L V, the resulting linear system is solved, and the weights are recomputed. This is an iteration, but it runs until it stops moving - |iterMax is a safety limit, not a tuning knob.
threshold is the turning angle at a single vertex of the result, not the total angle of the corner. The smoothing spreads a corner over roughly smoothingLength/h vertices, and the reweighting then sharpens it back, so the total angle that survives comes out several times larger than the threshold. On a hexagon smoothed with smoothingLength = 8*h the 60 degree corners come back as
threshold 30 15 8 4 2 degree corner 22 28 49 68 80 degree
A boundary with no corner at all is unaffected: a circle of radius R turns by h/R per vertex, far below any sensible threshold, so the filter returns exactly what curvatureFilter would.
Syntax
grains = smoothBoundary(grains,huberFilter)F = huberFilter;
F.smoothingLength = 3;
F.threshold = 3*degree;
grains = smoothBoundary(grains,F)Class Properties
| smoothingLength | wavelength damped to half amplitude, in map units (default: 4 times the vertex spacing) |
| threshold | per vertex turning angle above which a vertex counts as a corner and is preserved (default: 5 degree) |
| alpha | the regularization weight itself; overrides smoothingLength |
| iterMax | safety limit on the reweighting (default: 50) |
| tol | stop once no vertex moves further than this, relative to the vertex spacing (default: 1e-4) |
See also
grain2d.smoothBoundary boundaryFilter curvatureFilter taubinFilter
Citing this page.
This page is part of the documentation of
MTEX, a free and open
source MATLAB toolbox for analyzing and modeling crystallographic textures.
It was written by The MTEX Developers and is published at
https://mtex-toolbox.github.io/huberFilter.html.
If you use MTEX, or reuse text or figures from this page, in your research,
please cite
F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63
BibTeX
@article{bachmann2010mtex,
author = {F. Bachmann and R. Hielscher and H. Schaeben},
title = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
journal = {Solid State Phenomena},
volume = {160},
pages = {63-68},
year = {2010},
doi = {10.4028/www.scientific.net/SSP.160.63},
url = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}
Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.