Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recursive restrict as pyramid #29

Open
johnnychen94 opened this issue Oct 26, 2021 · 0 comments
Open

recursive restrict as pyramid #29

johnnychen94 opened this issue Oct 26, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@johnnychen94
Copy link
Member

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])

@johnnychen94 johnnychen94 added the enhancement New feature or request label Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant