You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> a =rand(RGB4{N0f8}, 100, 100);
julia> x =channelview(a);
julia> x[1,:,:]
ERROR:DimensionMismatch("new array has 100 color channels, must have 3")
Stacktrace:
[1] check_ncolorchan(::Array{ColorTypes.RGB4{FixedPointNumbers.Normed{UInt8,8}},2}, ::Tuple{Int64,Int64}) at /home/tim/.julia/v0.6/ImageCore/src/colorchannels.jl:356
[2] similar at /home/tim/.julia/v0.6/ImageCore/src/colorchannels.jl:117 [inlined]
[3] similar(::ImageCore.ChannelView{FixedPointNumbers.Normed{UInt8,8},3,Array{ColorTypes.RGB4{FixedPointNumbers.Normed{UInt8,8}},2}}, ::Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}) at ./abstractarray.jl:521
[4] macro expansion at ./multidimensional.jl:458 [inlined]
[5] _unsafe_getindex(::IndexCartesian, ::ImageCore.ChannelView{FixedPointNumbers.Normed{UInt8,8},3,Array{ColorTypes.RGB4{FixedPointNumbers.Normed{UInt8,8}},2}}, ::Int64, ::Base.Slice{Base.OneTo{Int64}}, ::Base.Slice{Base.OneTo{Int64}}) at ./multidimensional.jl:453
[6] macro expansion at ./multidimensional.jl:442 [inlined]
[7] _getindex at ./multidimensional.jl:438 [inlined]
[8] getindex(::ImageCore.ChannelView{FixedPointNumbers.Normed{UInt8,8},3,Array{ColorTypes.RGB4{FixedPointNumbers.Normed{UInt8,8}},2}}, ::Int64, ::Colon, ::Colon) at ./abstractarray.jl:882
This is actually far nastier than it might seem. The offending method is here. The problem is that method is presuming that what you're doing is trying to create another ChannelView, and so it's making sure that the new underlying array has a shape consistent with the first dimension being a color channel. But unfortunately similar gets used in two different ways.
I haven't spent much time thinking about it (deadlines...), but this doesn't seem to be entirely trivial to fix while preserving type-stability.
The text was updated successfully, but these errors were encountered:
As reported on gitter:
This is actually far nastier than it might seem. The offending method is here. The problem is that method is presuming that what you're doing is trying to create another
ChannelView
, and so it's making sure that the new underlying array has a shape consistent with the first dimension being a color channel. But unfortunatelysimilar
gets used in two different ways.I haven't spent much time thinking about it (deadlines...), but this doesn't seem to be entirely trivial to fix while preserving type-stability.
The text was updated successfully, but these errors were encountered: