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: facemark_aam_train_demo.m
    path of file: ./repos/mexopencv/opencv_contrib/samples
    
    the code of the file until where you have to start completion: %% Facemark AAM training demo
%
% The user should provides the list of training imag
    
function in this example is not
% optimal, you can always create your own function.
%
% The initialization is obtained by comparing the base shape of the trained
% model with the current face image. In this case, the rotation is obtained by
% comparing the angle of line formed by two eyes in the input face image with
% the same line in the base shape. Meanwhile, the scaling is obtained by
% comparing the length of line between eyes in the input image compared to the
% base shape.
%
% The fitting process starts by detecting faces in given image.
%
% If at least one face is found, then the next step is computing the
% initialization parameters. In this case, since |getInitialFitting| function
% is not optimal, it may not find pair of eyes from a given face. Therefore,
% we will filter out faces without initialization parameters and in this case,
% each element in the |confs| vector represent the initialization parameters
% for each filtered face.

%%
% create cascade detector objects (for face and eyes)
ccFace = cv.CascadeClassifier(xmlFace);
ccEyes = cv.CascadeClassifier(xmlEyes);

%%
% detect faces
img = cv.imread(testImg);
faces = myFaceDetector(img, ccFace);
assert(~isempty(faces), 'no faces found');
fprintf('%d faces\n', numel(faces));

%%
% get base shape from trained model
s0 = obj.getData();
s0 = cat(1, s0{:});

%%
% compute initialization params for each detected face
S = struct('R',eye(2), 't',[0 0], 'scale',1);
confs = S([]);
faces_eyes = {};
for i=1:numel(faces)
    [conf, found] = getInitialFitting(img, faces{i}, s0, ccEyes);
    if found
        confs(end