1. 程式人生 > >視訊序列轉化為單張影象

視訊序列轉化為單張影象

使用matlab將視序列轉換為單張影象。

 close all;  clc;  clear;    videopath =  '\indata\'; % 資料夾路徑    videoname = 'cam1.avi';%'IMG.MOV';  filename = 'out';  framerate = 1;%每幾張取一張     VideoPath = videopath;   VideoName = videoname;   FrameRate = framerate;   FilePath = ['./',filename,'/'];   if ~exist(FilePath)         mkdir(FilePath)    end       videoInfo = VideoReader([VideoPath,VideoName]);   for i = 1:FrameRate:videoInfo.NumberOfFrames         temp = read(videoInfo,i);         imwrite(temp,strcat(FilePath,sprintf('%d',i),'.jpg'),'jpg');% 儲存幀   end   Framepath = FilePath;