Overlay video on white background at specific location

11 ビュー (過去 30 日間)
Jessica Yorzinski
Jessica Yorzinski 2019 年 2 月 23 日
回答済み: Munish Raj 2019 年 2 月 26 日
I would like to create a new video (2560 x 1440 px) that consists of a section of my current video (240 fps; 1280 x 720 px) on a white background. But, I want to put my current video at a certain spot within this new video (i.e., pixel location 100 x 100). Does anyone know how to do that?
I am currently using this script to extract the section of the video that I want:
vid1 = VideoReader(LeftVideo,'CurrentTime',TimeOffset_L);
for i=1:FramestoSave
img1 = readFrame(vid1);
imgt=[img1];
step(videoPlayer, imgt);%play video
writeVideo(outputVideo, imgt); %record new video
end

回答 (1 件)

Munish Raj
Munish Raj 2019 年 2 月 26 日
Hello Jessica,
This can be done using MATLAB's matrix indexing.
You can create a 2560 x 1440 image, followed by writing the required pixels with the new pixels
bigVideo(0:100,0:100)=newVideo;
where newVideo is the frame of the overlayed video
This can be done in a for loop for every frame of both videos.
These individual frames can then be saved to a video.

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by