Interpolation filter in video
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alber
am 9 Mär. 2020
Kommentiert: Ameer Hamza
am 9 Mär. 2020
Hello,
I've been looking at the documentation on the 'interp' function, which is the function that I think I should use.
My problem is as follows: I have two types of images, alpha and negative alpha, which is alpha * (-1). Imagine that my alpha image goes from 1 to -1 and the negative alpha goes from -1 to 1, what I want to achieve is to create a video of numbers of Frames 'N', where the interpolation values are parameterizable, that is the interpolation time and the number of samples to be used, thus achieving a 'temporary' filtering.
The result of this function should be a 'N' frames video where what we will see will be in frame1: alpha, ...... frame3: alpha negative, .... frame5: alpha, frame7: alpha negative .. ..
Frame 3 is an example since it will depend on interpolation.
In the following image I show you an example of what it should be, to see if you can guide me or give a help with this problem.
Thank you very much in advance, any sure answer will help me, regards!
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 9 Mär. 2020
I am not sure why you scaled the pixels from -1 to 1. The following code use pixel values from 0 to 1, and the inverse image have pixel values from 1 to 0.
im = im2double(imread('peacock.jpg'));
im_reverse = 1-im;
N = 10;
time = reshape(linspace(0, 1, N), 1, 1, 1, N);
frames = im_reverse.*time + im.*(1-time);
v = VideoWriter('video_file', 'MPEG-4');
v.FrameRate = 10;
open(v);
for i = 1:5 % how many times to repeat pattern
% im to im_reverse
for j=1:N
frame = frames(:,:,:,j);
writeVideo(v, frame);
end
% im_reverse to im
for j=N:-1:1
frame = frames(:,:,:,j);
writeVideo(v, frame);
end
end
close(v);
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Computer Vision with Simulink finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!