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
- v: A videoWriter object that represents the video stream where the image will be written.
- I: The image to be written into the video. If not provided, the default is the current figure frame obtained using
getframe(gcf)
.
- n: The number of times the image should be written into the video. The default value is 1.
Algorithm Steps
- 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.
- The number of frames
n
is also retrieved from the input parameters, defaulting to 1 if not specified.
- The function then checks the dimensions of the video frame using
get(v,'Height')
and get(v,'Width')
, storing them in xyw
.
- The dimensions of the image
I
are obtained using size(I.cdata)
, and only the first two dimensions (height and width) are considered.
- 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
.
- 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