  
      return dir_contents
  
  # From: https://stackoverflow.com/questions/7323664/python-generator-pre-fetch
  import threading
  import queue as Queue
  class BackgroundGenerator(threading.Thread):
      def __init__(self, generator, prefetch=1): #See below why prefetch count is flawed
 
</s> remove from lib.cli import DirectoryProcessor
 </s> add from lib.cli import DirectoryProcessor, rotate_image </s> remove         count = 0

 </s> add  </s> remove from lib.utils import get_image_paths, get_folder
 </s> add from lib.utils import get_image_paths, get_folder, rotate_image </s> remove from lib.utils import BackgroundGenerator, get_folder, get_image_paths
 </s> add from lib.utils import BackgroundGenerator, get_folder, get_image_paths, rotate_image </s> remove         
 </s> add         parser.add_argument('-r', '--rotate-images',
                            type=str,
                            dest="rotate_images",
                            choices=("on", "off"),
                            default="off",
                            help="If a face isn't found, rotate the images through 90 degree "
                                 "iterations to try to find a face. Can find more faces at the "
                                 "cost of extraction speed.")
def rotate_image(image, angle):
    ''' Rotates an image by 90, 180 or 270 degrees. Positive for clockwise, negative for 
        counterclockwise '''
    if angle < 0: angle = sum((360, angle))
    if angle == 90:
        image = cv2.flip(cv2.transpose(image),flipCode=1)
    elif angle == 180:
        image = cv2.flip(image,flipCode=-1)
    elif angle == 270:
        image = cv2.flip(cv2.transpose(image),flipCode=0)
    else:
        print('Unsupported image rotation angle: {}. Image unmodified'.format(angle))
    return image

  
      return dir_contents
  
def rotate_image(image, angle):
    ''' Rotates an image by 90, 180 or 270 degrees. Positive for clockwise, negative for 
        counterclockwise '''
    if angle < 0: angle = sum((360, angle))
    if angle == 90:
        image = cv2.flip(cv2.transpose(image),flipCode=1)
    elif angle == 180:
        image = cv2.flip(image,flipCode=-1)
    elif angle == 270:
        image = cv2.flip(cv2.transpose(image),flipCode=0)
    else:
        print('Unsupported image rotation angle: {}. Image unmodified'.format(angle))
    return image

  # From: https://stackoverflow.com/questions/7323664/python-generator-pre-fetch
  import threading
  import queue as Queue
  class BackgroundGenerator(threading.Thread):
      def __init__(self, generator, prefetch=1): #See below why prefetch count is flawed
keep keep add keep keep keep keep keep
 Add image rotation for detecting more faces and dealing with awkward angles (#253)

* Image rotator for extract and convert ready for testing

* Revert "Image rotator for extract and convert ready for testing"

This reverts commit bbeb19ef26d2392b0f5f954dd202137a70444d4e.

Error in extract code

* add image rotation support to detect more faces

* Update convert.py

Amended to do a single check for for rotation rather than checking twice. Performance gain is likely to be marginal to non-existent, but can't hurt.

* Update convert.py

remove type

* cli.py: Only output message on verbose. Convert.py: Only check for rotation amount once

* Changed command line flag to take arguments to ease future development

* Realigning for upstream/Master

* Minor fix 
lib/utils.py