JuliaImages / ImageCore.jl

Julia types for representing images
Other
28 stars 20 forks source link

Incorrect `channelview` for `SubArray` #188

Open ymtoo opened 1 year ago

ymtoo commented 1 year ago

MWE:

(jl_TQljLn) pkg> st
Status `/tmp/jl_TQljLn/Project.toml`
  [a09fc81d] ImageCore v0.9.4

julia> x = rand(3,100,100,10); # 10 images

julia> @views x1 = x[:,:,:,1]; # first image

julia> size(x1)
(3, 100, 100)

julia> rgb_x1 = colorview(RGB, x1);

julia> size(rgb_x1)
(100, 100)

julia> channelview(rgb_x1) |> size
(3, 100, 100, 10)

julia> channelview(rgb_x1) == x # incorrect channelview
true

julia> x2 = x[:,:,:,1]; 

julia> rgb_x2 = colorview(RGB, x2);

julia> channelview(rgb_x2) |> size
(3, 100, 100)

julia> channelview(rgb_x2) == x
false

julia> channelview(rgb_x2) == x2
true

The channelview(rgb_x1) is equal to the 4D parent array of x1.