Prev: "matlabpool close" vs "matlabpool close force" ?
Next: Differentiate multiple plots in same figure.
From: Nandan Sawant on 31 May 2010 11:13 Here is a de-interlacing AVI script that works with mmreader function. Few people had asked about this on some earlier thread. This code runs successfully. % This Program is Capable deinterlacing AVI video of the european PAL % format (720 x 576, 25 fps). The Even and Odd fields are saved as frames % in a new AVI file. Essientially everything remains the same as the % original video except the frame rate and number of frames is doubled. % Author: Michael Egger, 2007 % Modified by: Nandan Sawant, 2010 % Modifications make this script compatible with mmreader instead of % aviread. % Load File for Splitting [name, path] = uigetfile('*.avi'); namepath = [path, name]; vid = mmreader(namepath); numFrames = get(vid, 'numberOfFrames'); Fps = get(vid, 'FrameRate'); hfm = repmat(rot90([0, 1]), 288, 720); output = cat(3, hfm, hfm, hfm); % Split Frames to Odd and Even Frames --> With Resizing h = waitbar(0, 'Reshaping Process... Please wait...'); for i = 1 : numFrames var = read(vid,i); out22{i} = imresize(reshape(var(output >0), [], 720, 3), [576 720]); out33{i} = imresize(reshape(var(output <1), [], 720, 3), [576 720]); h = waitbar(i/numFrames); end close(h); % Generate Output-File [FileName,PathName] = uiputfile('*.avi','Please Select Output-File', 'DefaultName') outvid = avifile(FileName); % Set Output-File Parameters (change as necessary) outvid.Quality = 100; outvid.Compression = 'None' outvid.Fps = 2*Fps; % Recombine Split-Frames to Output-Video h = waitbar(0, 'Saving Output-File... Please wait...'); for j = 1 : numFrames outvid = addframe(outvid, im2frame(out33{j})); outvid = addframe(outvid, im2frame(out22{j})); h = waitbar(numFrames); end close(h); % Write Output to File outvid = close(outvid);
From: witek on 1 Jun 2010 11:06 Hi, Alternatively, if you have access to the Video and Image Processing blockset, you can use the video.Deinterlacer System object to deinterlace your video. >> help video.Deinterlacer Deinterlacer Remove motion artifacts by deinterlacing input video signal HDINT = video.Deinterlacer returns a deinterlacing System object, HDINT, that removes motion artifacts from images composed of weaved top and bottom fields of an interlaced signal. .... Additionally, you may find: video.MultimediaFileWriter and video.MultimediaFileReader useful in the process of reading and writing your video. HTH, Witek Nandan Sawant <nonedonesawant(a)gmail.com> wrote: > Here is a de-interlacing AVI script that works with mmreader function. > Few people had asked about this on some earlier thread. > This code runs successfully. > > % This Program is Capable deinterlacing AVI video of the european > PAL > % format (720 x 576, 25 fps). The Even and Odd fields are saved as > frames > % in a new AVI file. Essientially everything remains the same as the > % original video except the frame rate and number of frames is > doubled. > > % Author: Michael Egger, 2007 > % Modified by: Nandan Sawant, 2010 > > % Modifications make this script compatible with mmreader instead of > % aviread. > > % Load File for Splitting > > [name, path] = uigetfile('*.avi'); > namepath = [path, name]; > vid = mmreader(namepath); > > numFrames = get(vid, 'numberOfFrames'); > Fps = get(vid, 'FrameRate'); > > hfm = repmat(rot90([0, 1]), 288, 720); > output = cat(3, hfm, hfm, hfm); > > % Split Frames to Odd and Even Frames --> With Resizing > h = waitbar(0, 'Reshaping Process... Please wait...'); > for i = 1 : numFrames > var = read(vid,i); > out22{i} = imresize(reshape(var(output >0), [], 720, 3), [576 > 720]); > out33{i} = imresize(reshape(var(output <1), [], 720, 3), [576 > 720]); > h = waitbar(i/numFrames); > end > close(h); > > % Generate Output-File > [FileName,PathName] = uiputfile('*.avi','Please Select Output-File', > 'DefaultName') > outvid = avifile(FileName); > > % Set Output-File Parameters (change as necessary) > outvid.Quality = 100; > outvid.Compression = 'None' > outvid.Fps = 2*Fps; > > % Recombine Split-Frames to Output-Video > h = waitbar(0, 'Saving Output-File... Please wait...'); > for j = 1 : numFrames > outvid = addframe(outvid, im2frame(out33{j})); > outvid = addframe(outvid, im2frame(out22{j})); > h = waitbar(numFrames); > end > close(h); > > % Write Output to File > outvid = close(outvid);
|
Pages: 1 Prev: "matlabpool close" vs "matlabpool close force" ? Next: Differentiate multiple plots in same figure. |