pg如何播放MP4
程序员文章站
2022-05-10 10:49:43
...
pg如何播放MP4
1. 使用matlab将mp4解成一张张图片
xyloObj = VideoReader('D:\PythonProject\XXX\resources\global.mp4');
nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;
for k = 1 : nFrames
im = read(xyloObj, k);%读取第k帧,存入im中
imwrite(im, ['D:\PythonProject\XXX\resources\g\original_frame',num2str(k),'.jpg'], 'bmp');%把im存储成图片,并且存储的文件名根据序号改变
end
2. 使用imagej,打包成tif
直接save as即可
3.Python code如下
self.projectVideoPath = './resources/project.tif'
self.tifProjectVideo = tifffile.imread(self.projectVideoPath)
self.gViewProjectVideo.setImage(self.tifProjectVideo, xvals=np.linspace(1., 10., self.tifProjectVideo.shape[0]), axes={'t': 0, 'x': 2, 'y': 1, 'c':3})
4. 最终效果
效果