Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
%downsample movies
rescaleFactor=1.5;
iptsetpref('ImshowBorder','tight');
cd('C:\Users\Public\Videos\Sample Videos\lizard_video_Ale\landscape')
movName='The Painted Desert Road 5.avi';
readerObj=VideoReader(movName);
tot_frames = readerObj.Duration * readerObj.FrameRate;
writerObj=VideoWriter([movName(1:end-4) '_us']);
open(writerObj);
% set starting time to read from movie file
readerObj.CurrentTime = 16;
f= readerObj.CurrentTime*readerObj.FrameRate;
while hasFrame(readerObj)
f = f+1
currF = readFrame(readerObj);
newF=imresize(currF,rescaleFactor);
if rescaleFactor < 1
blank=uint8(zeros(readerObj.Height, readerObj.Width,3));
midH=(readerObj.Height/2-round(size(newF,1)/2)+300);
midW=(readerObj.Width/2-round(size(newF,2)/2));
blank(midH:midH+size(newF,1)-1,midW:midW+size(newF,2)-1,:)=newF;
imshow(blank)
currFrame = getframe;
else
currFrame = newF;
end
writeVideo(writerObj,currFrame);
end
close(writerObj);
%
% for f=500:tot_frames%readerObj.NumberOfFrames
% f
% currF=read(readerObj,[f f]);
% blank=uint8(zeros(readerObj.Height, readerObj.Width,3));
% newF=imresize(currF,rescaleFactor);
%
% midH=(readerObj.Height/2-round(size(newF,1)/2)+300);
% midW=(readerObj.Width/2-round(size(newF,2)/2));
% blank(midH:midH+size(newF,1)-1,midW:midW+size(newF,2)-1,:)=newF;
%
% imshow(blank)
% currFrame = getframe;
% writeVideo(writerObj,currFrame);
% end