Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 29 days 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 (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-29T18:31:02.000Z (over 1 year ago)
- Last Synced: 2024-11-30T20:05:14.404Z (about 2 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
[![Build Status](https://github.com/jw3126/MeanFilters.jl/workflows/CI/badge.svg)](https://github.com/jw3126/MeanFilters.jl/actions)
[![Coverage](https://codecov.io/gh/jw3126/MeanFilters.jl/branch/master/graph/badge.svg)](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)
```