Decompose
the video
to frames using matlab
1-
Read the video.
2-
Get the number of frames in
the video.
3-
Name the frames.
4-
And save the images .
Modified
random frames
1- Read the directory
contain the frames of the original video.
2- Get the number
of images.
3- Create a random
number.
4- Replace a number
of frames by adding to others frames.
Reconstruct the video
1- Create matlab
movie structure .
2- Read the images.
3- Show the images.
4- Get frames from
gca.
5- Create the
movie.
6- Play the movie.
Detect the modification
1-
Read
the video.
2-
Decompose
into frames.
3-
Difference between to image.
4-
Convert
into binary.
5-
Message
box the frames that are modified.
function
detect_modif(video_dir)
video = mmreader(video_dir);
video_frames = read(video);
nb_frames = get(video, 'numberOfFrames');
mkdir('test')
mov(1).cdata = video_frames(:,:,:,1);
mov(1).colormap = [];
name1=strcat('test\test',int2str(1),'.jpeg');
imwrite(mov(1).cdata, name1);
h=0;
s=0;
for k = 2 : nb_frames
mov(k).cdata = video_frames(:,:,:,k);
mov(k).colormap = [];
name1=strcat('test\test',int2str(k),'.jpeg');
imwrite(mov(k).cdata, name1);
im=strcat('test\test',num2str(k),'.jpeg');
im1=imread(im);
imm=strcat('test\test',num2str(k-1),'.jpeg');
imm1=imread(imm);
diff_imm = imabsdiff(im1(:,:),imm1(:,:));
diff_imbww= im2bw(diff_imm);
bwarea = bwareaopen(diff_imbww,60);
x(k)=mean(mean(bwarea));
end
h=max(x);
[tf, index] = ismember(max(x),
x);
x(index)=0;
hh=max(x);
x(index)=h;
for k = 2 : nb_frames
if (x(k)>=hh)
s=s+1;
S(s)=k;
%msgbox(sprintf('These Values are
incorrect WARNING %f warn',k));
end
end
msgbox(sprintf('this video is
modified the modification is between the frame : %f and %g',S(s-1),S(s)-1),'WARNING','warn');
No comments:
Post a Comment