downsample from image 360*640 to 180*320

4 ビュー (過去 30 日間)
Andrea Gusmara
Andrea Gusmara 2020 年 5 月 22 日
コメント済み: Ameer Hamza 2020 年 5 月 22 日
hi to everyone , I would to ask two question . the first is place in the title , and i know that i'm going to lose data , but i need to. the image in question i frame in the code under
. the second is that i'm trying to execute this code , but somthing wrong append .
video1=VideoReader('Francesca-Michielin---No-Degree-Of-Separation-Italy-Live-at-Semi-Final-2.mp4');
video2=VideoReader('Jamala---1944-Ukraine-Live-at-Semi-Final-2-of-the-2016-Eurovision-Song-Contest.mp4');
videoOut=VideoWriter('provaMix.avi');
videoOut.FrameRate=video1.FrameRate;
open(videoOut)
frames=read(video1,[1 2316]);
for frame=frames
% eventualmente resize (downsampling) del frame
writeVideo(videoOut,frame);
end
thank so much

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 22 日
See imresize(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/imresize.html. Use it with a scaling factor of 0.5;
frame_small = imresize(frame, 0.5)
For videoReader object, use readFrame() function to read a frame at a time, as shown in this example:: https://www.mathworks.com/help/releases/R2020a/matlab/ref/videoreader.html#busqe2j-1_1

その他の回答 (1 件)

Andrea Gusmara
Andrea Gusmara 2020 年 5 月 22 日
Thanks you for your answer. For the second question, is there any function that permits to read more frames? I have seen the functions readFrame and read. I have read the documentation about the latter function but I couldn't use it very well. The documentation said that a frame range could be recovered
  3 件のコメント
Andrea Gusmara
Andrea Gusmara 2020 年 5 月 22 日
No errors, the function returned only a value
Ameer Hamza
Ameer Hamza 2020 年 5 月 22 日
Your for loop is wrong. Write it like this
frames=read(video1,[1 2316]);
for idx=1:2316
% eventualmente resize (downsampling) del frame
writeVideo(videoOut,frames(:,:,:,i));
end

サインインしてコメントする。

カテゴリ

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