I’m trying to read a few frames of video from a file and reshape the data into a three-dimensional array. I’m getting an infinite recursion when reshaping the array.
using VideoIO
io = VideoIO.testvideo("ladybird")
f = VideoIO.openvideo(io)
viddata = read(f)[:]
for i = 1:10 # read just a few frames
append!(viddata, read(f))
end
vid = reshape(viddata, f.height, f.width, :) # stack overflow here
ERROR: StackOverflowError:
Stacktrace:
[1] reshape(::Array{ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}},1}, ::Tuple{Int32,Int32,Colon}) at /home/username/.julia/packages/OffsetArrays/46NUD/src/OffsetArrays.jl:111 (repeats 79984 times)
I don’t understand why OffsetArrays is getting involved here. My data type is
typeof(viddata)
Array{ColorTypes.RGB{FixedPointNumbers.Normed{UInt8,8}},1}
Any thoughts on what’s gone wrong?
Thanks.