Interpolation filter in video
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/276024/image.jpeg)
0 commentaires
Réponse acceptée
Ameer Hamza
le 9 Mar 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Multirate Signal Processing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!