JuliaImages / JuliaImages/ImageFiltering.jl

Error with `mapwindow` and custom function, when the window is greater than 2x the size of the inputs

Open
#262 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
104
Forks
52
PR merge metrics
No merged PRs in 30d

Description

function extrema_range(x)
    extx = extrema(x)
    return extx[2] - extx[1]
end

julia> mapwindow(extrema_range, randn(21), (41,))
3.816084076236648

julia> mapwindow(extrema_range, randn(21), (43,))
ERROR: DimensionMismatch: CartesianIndices((1:0,)) must be in the interior of CartesianIndices((21,))
Stacktrace:
 [1] EdgeIterator
   @ C:\Users\nicho\.julia\packages\TiledIteration\MBTB8\src\TiledIteration.jl:28 [inlined]
 [2] EdgeIterator
   @ C:\Users\nicho\.julia\packages\TiledIteration\MBTB8\src\TiledIteration.jl:32 [inlined]
 [3] mapwindow_kernel!(f::typeof(extrema_range), out::Vector{Float64}, img::Vector{Float64}, window::Tuple{UnitRange{Int64}}, border::Pad{0}, imginds::Tuple{Base.OneTo{Int64}})
   @ ImageFiltering.MapWindow C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:297
 [4] _mapwindow
   @ C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:104 [inlined]
 [5] mapwindow(f::typeof(extrema_range), img::Vector{Float64}, window::Tuple{Int64}; border::String, indices::Tuple{Base.OneTo{Int64}}, callmode::Symbol)
   @ ImageFiltering.MapWindow C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:80
 [6] mapwindow(f::typeof(extrema_range), img::Vector{Float64}, window::Tuple{Int64})
   @ ImageFiltering.MapWindow C:\Users\nicho\.julia\packages\ImageFiltering\TdGNZ\src\mapwindow.jl:75
 [7] top-level scope
   @ REPL[91]:1

julia> mapwindow(extrema, randn(21), (43,)) # built-in works

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with mapwindow(extrema_range, randn(21), (43,)) and compare it with the working window size and built-in extrema case. Start in src/mapwindow.jl, then inspect the EdgeIterator code referenced in TiledIteration.jl:28-32; done means the custom function works when the window exceeds twice the input size without a DimensionMismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.