I forked this repo initially ment for MATLAB to write it again in python, Julia and with luck even make it a ImageJ extension. Is a very interesting Digital Filter. In short, It smooths an image while preserving strong edges.
-
If a region has low variance, it’s likely smooth (sky, wall, etc.), so it gets blurred more.
-
If a region has high variance (edges, textures), it’s likely important detail, so it’s preserved.
First descoription of this filter is in the article Multi-scale Image Decomposition Using a Local Statistical Edge Model. For details go check the paper.
![]() |
![]() |
![]() |
|---|---|---|
| Input | Per-pixel preservation (A) | Filtered (result) |
It decomposes an image into coarse (base), medium, and fine detail layers, then enhances those details using amplification factors.
![]() |
|---|
| Both medium and fine details enhanced |
- Radius (r)
Think of it like blur size or scale of smoothing.
- Epsilon (e)
Defines the variance threshold to decide what is an "edge" versus a "flat area".
| Parameter | Symbol | Meaning | Effect |
|---|---|---|---|
r |
(radius) | Size of the local analysis window (in pixels). | Controls how much area around each pixel is considered for variance estimation. |
e |
(epsilon) | Threshold variance defining what counts as an “edge.” | Controls how strongly edges are preserved. |
Try the defaults: radius=3, epsilon=0.025, m_amp=2.0, f_amp=3.0.
Increase radius for more smoothing, decrease for sharper details.
- If edges look too soft → decrease epsilon.
- If too harsh or noisy → increase epsilon.
m_amp: affects edges and contrast.
f_amp: affects micro-textures. Start from 1.0 (neutral) and raise gradually.
- Don’t set both amplifications too high (>4).
Key differences and improvements in the Julia version:
- Julia's JIT compilation can make this code faster than the Python version
- Better memory management and vectorization
To use this code:
using Pkg
Pkg.add(["Images", "ImageFiltering", "FileIO", "ArgParse"])
julia svf_enhance.jl input_image.jpg --radius 3 --epsilon 0.025 --m_amp 2.0 --f_amp 3.0 --output enhanced.pngThe Julia version maintains the same functionality while leveraging Julia's performance characteristics and type system.



