Change colour of specific frames in a avi video

6 ビュー (過去 30 日間)
Ines Domingos
Ines Domingos 2018 年 2 月 2 日
Hi.
I have a .avi video with 37958 frames. I need to change the colour of some specific frames (more than 3000), for example to red or to a grayscale. Then, I have to play the movie again and watch the changed frames. I know how to process the video, but I don't know how to change the colour of specific frames. The index of the frames that I need to change are stored in the array k. Can anyone help me? This is my code:
close all;
clc
cd 'H:\Desktop\Poses_files'
%%Create a VideoReader object to read data
v = VideoReader('ines_output.avi');
vidWidth = v.Width;
vidHeight = v.Height;
%%Create a movie structure array
mov = struct('cdata',zeros(vidHeight,vidWidth,3,'uint8'),...
'colormap',[]);
%%Read one frame at a time until the end of the video
j = 1;
while hasFrame(v)
mov(j).cdata = readFrame(v);
j = j+1;
end
%%Change frames with peaks
min_peaks= islocalmin(y1,'MinProminence',2);
k=find(min_peaks);
n=1;
while n<=length(k)
mov(k(n))= ;
n=n+1;
end
for frame = 1 : length(k)
% Extract the frame from the movie structure.
thisFrame = readframe(v, frame);
end
%%Play the movie
hf = figure;
set(hf,'position',[150 150 vidWidth vidHeight]);
movie(hf,mov,1,v.FrameRate);
Many thanks,
Ines

回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by