在IDL中,我有一个在不同时间包含(灰度)图像的数据立方体:datacube [w,h,frames]。现在我想使用IDLFFVideoWrite将该数据立方体转换为动画,但问题是,Put-Method只吃排序框架的帧[3,w,h]。
如何将我的datacube的单帧转换为适合的帧,IDLffVideoWrite :: Put会吃?
答案 0 :(得分:0)
你有灰度图像,所以我们需要让所有三个波段(R,G和B)只是一个波段的副本。 REBIN
和REFORM
是"杂耍维度的工具"那样:
frame = rebin(reform(datacube[*, *, i], 1, w, h), 3, w, h)
只要datacube
是字节数据,frame
就适合IDLffVideoWrite::put
。
更新:编辑答案,因为评论中的格式选项有限。
所以你实际上有这个表格的datacube
:
datacube[w, h, 3 * n_frames]
因此,您应该对datacube
执行此操作,以便更轻松地处理:
datacube = transpose(reform(datacube, w, h, 3, n_frames), [2, 0, 1, 3])
然后,要获得i
帧,您可以这样做:
frame = reform(datacube[*, *, *, i])