A second thought on JuliaImages/Images.jl#971 (comment)
gaussian_pyramid -> maybe ImageFiltering with new name build_pyramid and supports generic kernels. (EDIT @timholy: I don't think we can, gaussian_pyramid requires imresize from ImageTransformations. This might be a good candidate for remaining in Images.jl.)
It might be useful to define a more generic version of build_pyramid here with function f input.
# apply `f(restrict(img, dims))` recursively for `n_scales` times
build_pyramid(f=identity, img; dims::Dims, n_scales::Int)
# apply `f(restrict(img, dims))` recursively until `all(size(smallest_img) .< stop_size)` holds
build_pyramid(f=identity, img; stop_size)
When f(x) = imfilter(img, KernelFactors.IIRGaussian(sigma), NA()) then it becomes a gaussian pyramid.
The benefit is that we get a more generic version, and since we don't rely on either imresize or imfilter, we can keep this function in ImageBase.
FWIW, building pyramid also falls into the reduce diagram: build_pyramid(f, x::AbstractArray, n) = reduce((x,y)->push!(x, f(restrict(last(x)))), 1:n; init=[x])
A second thought on JuliaImages/Images.jl#971 (comment)
It might be useful to define a more generic version of
build_pyramidhere with functionfinput.When
f(x) = imfilter(img, KernelFactors.IIRGaussian(sigma), NA())then it becomes a gaussian pyramid.The benefit is that we get a more generic version, and since we don't rely on either
imresizeorimfilter, we can keep this function in ImageBase.FWIW, building pyramid also falls into the
reducediagram:build_pyramid(f, x::AbstractArray, n) = reduce((x,y)->push!(x, f(restrict(last(x)))), 1:n; init=[x])