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我是做錯誤。