0
我想要读取电影的第一帧,裁剪(丢弃)帧的上半部分,然后将此新(想要)帧保存到新电影中,然后第二帧等等..亲切地帮助我,我该如何做到这一点。 到目前为止,我已经试过这样:从电影中读取和裁剪帧
clc;
clear all;
obj=mmreader('2.avi'); % input movie file
mov=read(obj);
frames=get(obj,'numberOfFrames'); %get the number of frames
cmap=zeros(256,3);
for i=1:10
cmap(i,1)=(i-1)/255;
cmap(i,2)=(i-1)/255;
cmap(i,3)=(i-1)/255;
end;
aviobj=avifile('c:\new_movie_file.avi','compression','none','colormap',cmap);
for k = 1 : 10
I(k).cdata = mov(:,:,:,k); %store frame information in an array vector
I(k).colormap = [];
end
for j = 1 : 10
%get the first frame from the movie
%frame1=mov(1,k);
%extract the colour data AND crop
frame2=I(j).cdata(:,100:end); % I am confused how to write this statement properly to crop the image frame from desired row number
%add to avi file
aviobj=addframe(aviobj,frame2);
end;
%close file!
aviobj=close(aviobj);
implay(aviobj); % It displays a movie which contains three separate overlaped frames(windows) of the original movie in distorted form
请帮我this..where我是做错误。