%% Create Image Data Augmenter to Resize and Reflect Images
% Create an image augmenter that preprocesses images before training. This augmenter resizes and reflects images at random.

augmenter = imageDataAugmenter( ...
    'RandXReflection',true, ...
    'RandXScale',[1 2], ...
    'RandYReflection',true, ...
    'RandYScale',[1 2])

%
% Include the image augmenter in an augmented image datastore. The augmented image datastore also requires sample data, classifications, and an output image size.

[XTrain,YTrain] = digitTrain4DArrayData;
imageSize = [28 28 1];
datastore = augmentedImageDatastore(imageSize,XTrain,YTrain,'DataAugmentation',augmenter)

% Copyright 2012 The MathWorks, Inc.