title: How to use the python method "ImageDataGenerator" and save the augmented images in a variable?
body: <p>I'm constructing an augmented database to improve my CNN. The scheme is:</p>
  <ul>
  <li>I send an image, one per time, to generate another 40 images.</li>
  <li>The quoted method saves the augmented images in a directory, but I want to save them in a variable without saving them firstly in my computer. That is, I want to save directly in a variable.</li>
  </ul>
  <p>The code above shows what I'm talking about. Take a look at the parameter &quot;save_to_dir&quot;... If I neglect it the processing is made but the data isn't saved anywhere.
  Can anyone help me?</p>
  <pre><code>import numpy as np
  from keras.preprocessing.image import load_img
  from keras.preprocessing.image import img_to_array
  from keras.preprocessing.image import ImageDataGenerator
  import matplotlib.pyplot as plt
  import cv2
  
  IMAGE_PATH = &quot;---&quot;
  OUTPUT_PATH = &quot;---&quot;
  
  image = cv2.imread(IMAGE_PATH)
  plt.imshow(image)
  
  image = np.expand_dims(image, axis=0)
  
  imgAug = ImageDataGenerator(rotation_range=360, width_shift_range=0.1, height_shift_range=0.1, zoom_range=0.20, fill_mode='wrap',     horizontal_flip=True, vertical_flip=True)
  
  imgGen = imgAug.flow(image, save_to_dir=OUTPUT_PATH,
                       save_format='png', save_prefix='dentezudo_')
  
  counter = 0
  for (i, newImage) in enumerate(imgGen):
      counter += 1
  
      if counter == 10:
          break
  </code></pre>