Papers
Topics
Authors
Recent
Search
2000 character limit reached

Li–Osher Weighted Median Filter

Updated 27 April 2026
  • Weighted Median Filtering (Li–Osher) is an edge-preserving nonlinear filter that employs local weighted L1 minimization to adaptively refine image and motion boundaries.
  • It leverages heterogeneous patch similarity weights to suppress noise while maintaining sharp discontinuities in optical flow estimation.
  • Its integration in variational optical flow pipelines yields measurable improvements in angular and endpoint error metrics on benchmark datasets.

The Li–Osher weighted median filter is an edge-preserving nonlinear filter defined by a local, weighted minimization of the L1L^1 loss. It extends the classical median filter by allowing heterogeneous weighting of observations, resulting in enhanced adaptability to image and motion boundaries. The weighted median, as introduced by Li and Osher in the context of PDE-based denoising, has been leveraged as a critical post-processing refinement in optical flow methods to better preserve flow discontinuities while suppressing noise. Doshi and Kiran (Doshi et al., 2022) implement this filter as the final sharpening step in an edge-preserving variational optical-flow pipeline, reporting marked improvements in both flow accuracy and edge fidelity.

1. Mathematical Formulation

At each pixel xΩx \in \Omega, for a scalar signal u(x)u(x) (e.g., a flow component), the filter operates on the local square neighborhood

WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}

with half-width RR. Each neighbor yy is assigned a nonnegative weight w(x,y)w(x, y). The filtered output v(x)v(x) is the minimizer of the weighted L1L^1 cost:

v(x)=argminzRyWR(x)w(x,y)zu(y).v(x) = \underset{z \in \mathbb{R}}{\arg\min} \sum_{y \in W_R(x)} w(x, y)\,|z - u(y)|.

Alternatively, defining the nondecreasing order statistics xΩx \in \Omega0 (with corresponding weights xΩx \in \Omega1), xΩx \in \Omega2 is the smallest xΩx \in \Omega3 for which the cumulative weight xΩx \in \Omega4 satisfies xΩx \in \Omega5.

2. Parameters and Weight Computation

Three principal parameters define the filter:

  • Window size xΩx \in \Omega6: Typical choices are xΩx \in \Omega7, selected and tuned per dataset or sequence.
  • Patch similarity weights xΩx \in \Omega8: For any xΩx \in \Omega9,

u(x)u(x)0

where u(x)u(x)1 is a Gaussian with standard deviation u(x)u(x)2 (patch-smoothing), u(x)u(x)3 is a contrast-sensitivity parameter (often the flow grid spacing), and u(x)u(x)4 is the reference image. Both u(x)u(x)5 and u(x)u(x)6 are jointly tuned per sequence.

  • (Optional) Regularization term: The generalized energy u(x)u(x)7 is used with u(x)u(x)8, yielding a pure weighted median.

Weights are computed based on patch similarity, following the nonlocal means paradigm, with larger u(x)u(x)9 for similar patches.

3. Algorithmic Implementation

A single pass proceeds as follows for each pixel WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}0:

  1. Neighborhood extraction: Collect WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}1 with WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}2.
  2. Weight computation: For each WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}3, compute WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}4.
  3. Sort and select:
    • Form the set of pairs WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}5 for all WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}6.
    • Sort by WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}7 in ascending order.
    • Accumulate weights, select the minimal WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}8 at which accumulated weight passes half the total, set as WR(x)={yΩ:yxR}W_R(x) = \{ y \in \Omega : \| y-x \|_\infty \le R \}9.

Boundary handling is performed by mirror-padding or clamping at image edges. Weights RR0 are recomputed only once per sequence or iteration and cached. Sorting is implemented via bucket sort or RR1 selection algorithms, where RR2. Per-pixel computational complexity is RR3 for both weight lookup and median selection.

4. Integration in Optical Flow Estimation

The weighted median filter is applied as a post-processing refinement after coarse-to-fine variational optical flow estimation with RR4-TV regularization solved by the Chambolle–Pock primal–dual scheme. At each pyramid level, after the final (possibly iterated) classical median filtering, the Li–Osher weighted median filter is applied once per flow component. The output is upsampled for initialization at the next pyramid level. Only a single weighted median pass is conducted per level, with the final, full-resolution pass being emphasized for edge sharpening.

Pipeline summary:

Step Operation Location in Pipeline
Solve variational flow Chambolle–Pock primal-dual Per pyramid level
Iterated median Standard (unweighted) median, possibly multiple passes Per pyramid level
Weighted median Li–Osher filter, one pass per flow component After all variational and iterated median steps

5. Empirical Performance and Edge Preservation

Application of the weighted median filter as the final refinement sharpens flow-field discontinuities—specifically at object boundaries—mitigating “bleeding” artifacts intrinsic to RR5-TV regularization. On the Middlebury optical flow dataset, the end-to-end pipeline of Doshi & Kiran, which incorporates both iterated median and Li–Osher weighted median filtering, achieves an average angular error (AAE) of RR6 and an average end-point error (EPE) of RR7 pixels, improving upon HS+nonlocal (RR8, RR9 px) and HS+nonlocal+guided filter (yy0, yy1 px). Approximately yy2 of the edge fidelity improvement is attributed to the weighted median step, as observed by the authors. In controlled tests with synthetic data, the filter preserves sharp motion edges even under heavy Gaussian or salt-and-pepper noise, outperforming pure iterated median filtering in maintaining crisp vector-field boundaries (Doshi et al., 2022).

6. Implementation Optimizations

To ensure computational feasibility, weights are cached in compact (yy3 arrays per-pixel or per-warp. Efficient yy4 selection strategies are employed for the median calculation. No GPU acceleration is reported, but the algorithm's pixelwise independence is well-suited for parallelization on architectures such as CUDA. For yy5, real-time application is considered practically attainable on modern hardware.

7. Context, Limitations, and Further Directions

The Li–Osher weighted median filter generalizes the median to accommodate spatially or photometrically varying influences, enhancing edge-preservation over classical filters. Its use in variational optical flow estimation demonstrates the practical utility of patch-based weighting rooted in nonlocal means concepts. While the improvement in flow accuracy attributable solely to the weighted median is not isolated in ablation studies, integration within existing variational frameworks yields measurable benefits in edge sharpness and accuracy under noise. A plausible implication is that further optimization, adaptive parameter learning, or extension to higher-dimensional flows could enhance performance in related imaging and motion analysis applications (Doshi et al., 2022).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Weighted Median Filtering (Li–Osher).