JuliaImages / ImageFiltering.jl

Julia implementations of multidimensional array convolution and nonlinear stencil operations
Other
99 stars 49 forks source link

Possible bug when passing identity mapping to mapwindow #163

Closed oschub closed 4 years ago

oschub commented 4 years ago

I ran into some unexpected behaviour when passing the identity mapping to mapwindow:

julia> using ImageFiltering

julia> X = reshape(1:9, 3, 3)
3×3 reshape(::UnitRange{Int64}, 3, 3) with eltype Int64:
 1  4  7
 2  5  8
 3  6  9

julia> mapwindow(x->x, X, (1,1))
3×3 Array{Array{Int64,2},2}:
 [9]  [9]  [9]
 [9]  [9]  [9]
 [9]  [9]  [9]

Passing x -> 1x does return the expected result though.

julia> mapwindow(x->1x, X, (1,1))
3×3 Array{Array{Int64,2},2}:
 [1]  [4]  [7]
 [2]  [5]  [8]
 [3]  [6]  [9]

Not sure if this is intended behaviour or a bug.

jw3126 commented 4 years ago

From what I remember, this is documented in the mapwindow docstring. Can you check and report back if it is missing/unclear?

oschub commented 4 years ago

Yes, you're right. My apologies.

jw3126 commented 4 years ago

No problem and thanks for reporting back.