https://github.com/jw3126/meanfilters.jl
Fast and simple sliding window mean filter.
https://github.com/jw3126/meanfilters.jl
image-processing julia moving-mean
Last synced: 3 months ago
JSON representation
Fast and simple sliding window mean filter.
- Host: GitHub
- URL: https://github.com/jw3126/meanfilters.jl
- Owner: jw3126
- License: mit
- Created: 2021-09-10T13:58:29.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-29T18:31:02.000Z (about 2 years ago)
- Last Synced: 2025-03-11T12:46:41.346Z (4 months ago)
- Topics: image-processing, julia, moving-mean
- Language: Julia
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MeanFilters
[](https://github.com/jw3126/MeanFilters.jl/actions)
[](https://codecov.io/gh/jw3126/MeanFilters.jl)The goal of this package is to solve one very narrow problem: compute the mean over a sliding window:
```julia
julia> using MeanFilters: meanfilterjulia> meanfilter([1,2,3,4], (-1:1,))
4-element Vector{Float64}:
1.5
2.0
3.0
3.5julia> meanfilter([1 2 3; 4 5 6], (0:0,-1:1))
2×3 Matrix{Float64}:
1.5 2.0 2.5
4.5 5.0 5.5
```In most cases you likely want to use [ImageFiltering.jl](https://github.com/JuliaImages/ImageFiltering.jl) instead. Advantages of this package over [ImageFiltering.jl](https://github.com/JuliaImages/ImageFiltering.jl) are:
* Tiny dependency
* Specialized algorithm for mean, which has decent performance for large windows:
```julia
using ImageFiltering
using BenchmarkTools
using MeanFiltersarr = randn(1000, 1000)
window = (-50:50, -20:20)
ker = fill(1/prod(length, window), window...)
out1 = @btime imfilter(arr, ker, NA())
out2 = @btime meanfilter(arr, window)
@assert out1 ≈ out2
```
```
45.249 ms (443 allocations: 109.50 MiB)
3.074 ms (247 allocations: 15.28 MiB)
```