我正在使用Matlab代码从视频文件中提取帧。问题是如果我只从相机拍摄图像并提取与同一相机拍摄的视频帧不同的特征,保持所有环境条件相同。
以下是代码:
mov = VideoReader(filename);
outputFolder = fullfile('H:\VID_20150513_123447324');
if ~exist(outputFolder, 'dir')
mkdir(outputFolder);
end
numberOfFrames = mov.NumberOfFrames;
numberOfFramesWritten = 0;
for frame = 1 : numberOfFrames
thisFrame = read(mov, frame);
outputBaseFileName = sprintf('Test_%d.jpg', frame);
outputFullFileName = fullfile(outputFolder, outputBaseFileName);
imwrite(thisFrame, outputFullFileName, 'jpg'); numberOfFramesWritten =
numberOfFramesWritten + 1;
end