Interpolation filter in video
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Ameer Hamza
2020년 3월 9일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!