You can useaugmentedImageDatastoreto augment the images read byimageDatastore. The cropping function can be achieved using theOutputSizeModeas‘centercrop’.You may ‘randcrop’ also if you want cropping to be random instead of focusing at center. Below code might help.
imageDataStore is introduced in R2016a. If you are using R2015b or before, you cannot use it and you get the result like "undefined function." If you are using R2014b or later version, use datastore function instead with setting Type option as 'image.'
Best Answer