You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: non_local_means_demo.m
    path of file: ./repos/mexopencv/samples
    
    the code of the file until where you have to start completion: %% Non-Local Means Image Denoising
%
% In this demo, we will learn:
%
% * about Non-local Means Denoising algorithm to remove noise in an image.
% * how to use functions like |cv.fastNlMeansDenoising|,
%   |cv.fastNlMeansDenoisingColored|, and |cv.fastNlMeansDenoisingMulti|
%
% Sources:
%
% * <https://docs.opencv.org/3.2.0/d5/d69/tutorial_py_non_local_means.html>
%

%% Theory
%
% We have previously seen many image smoothing techniques like Gaussian
% Blurring, Median Blurring, etc. and they were good to some extent in
% removing small quan
    
function is the list of noisy frames.
% * Second argument |imgToDenoiseIndex| specifies which frame we need to
%   denoise, for that we pass the index of frame in our input list (0-based).
% * Third is |temporalWindowSize| which specifies the number of nearby frames
%   to be used for denoising. It should be odd.
%
% In that case, a total of |temporalWindowSize| frames are used where central
% frame is the frame to be denoised. For example, you passed a list of 5
% frames as input. Let |imgToDenoiseIndex = 2| and |temporalWindowSize = 3|.
% Then |frame-1|, |frame-2| and |frame-3| are used to denoise |frame-2|.
%

%% Video
% Open input video
if ~mexopencv.isOctave() && mexopencv.require('images')
    fname = fullfile(toolboxdir('images'), 'imdata', 'AT3_1m4_%02d.tif');
else
    fname = fullfile(mexopencv.root(), 'test', '768x576.avi');
end