imageVideoWrite

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Video/Audio/PDF
Introduced first in SolidGeometry 3.2, Creation date: 2016-12-28, Last change: 2025-09-14

writes an image several times into an open videostream

Description

if the image does not have the size of the videoWriter and is not the first part of the video, it is resized to fit into the video frame

See Also: imageVideoFrames , imageVideoTitle , imageVideoTextPage , imageVideoEndtitle , videoCopyFrames , videoCopyCutMovies

Example Illustration

 missing image of imageVideoWrite (v,I,n)

Syntax

imageVideoWrite(v,[I,n])

Input Parameter

v: videoWriter
I: Image; default is getframe(gcf)
n: number of frames; default is 1

Examples


imageVideoWrite (v,I,2*get(vr,'FrameRate'));




Copyright 2016-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, imageVideoWrite, is designed to write an image multiple times into an open video stream using MATLAB's videoWriter object. Below is a detailed explanation of the algorithm and its parameters:

Input Parameters

Algorithm Steps

  1. The function begins by retrieving the image I from the input parameters using getfuncparams. If I is not provided, it defaults to the current figure frame.
  2. The number of frames n is also retrieved from the input parameters, defaulting to 1 if not specified.
  3. The function then checks the dimensions of the video frame using get(v,'Height') and get(v,'Width'), storing them in xyw.
  4. The dimensions of the image I are obtained using size(I.cdata), and only the first two dimensions (height and width) are considered.
  5. If the dimensions of the image do not match the video frame size and the video is not in its first part, the image is resized to fit the video frame using imresize.
  6. A loop runs n times, writing the image I into the video stream using writeVideo(v,I).

This function is part of the SolidGeometry library and is used to ensure that images are correctly sized and repeatedly written into a video stream, facilitating the creation of videos with consistent frame sizes.

Algorithm explaination created using ChatGPT on 2025-08-19 00:52. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21