                  for idx, face in faces:
                      if self.input_aligned_dir is not None and self.check_skipface(filename, idx):
                          print ('face {} for frame {} was deleted, skipping'.format(idx, os.path.basename(filename)))
                          continue
                      image = converter.patch_image(image, face, 64 if "128" not in self.arguments.trainer else 128)
                      # TODO: This switch between 64 and 128 is a hack for now. We should have a separate cli option for size
  
              output_file = get_folder(self.output_dir) / Path(filename).name
              cv2.imwrite(str(output_file), image)
          except Exception as e:
              print('Failed to convert image: {}. Reason: {}'.format(filename, e))
 
</s> remove         faces = detect_faces(image, self.arguments.detector)
 </s> add         faces = detect_faces(image, rotation, self.arguments.detector) </s> remove     def get_faces(self, image):
 </s> add     def get_faces(self, image, rotation=0):
                    # Check for image rotations and rotate before mapping face
                    if face.r != 0:
                        image = rotate_image(image, face.r)
                        image = converter.patch_image(image, face, 64 if "128" not in self.arguments.trainer else 128)
                        # TODO: This switch between 64 and 128 is a hack for now. We should have a separate cli option for size
                        image = rotate_image(image, face.r * -1)
                    else:
                        image = converter.patch_image(image, face, 64 if "128" not in self.arguments.trainer else 128)
                        # TODO: This switch between 64 and 128 is a hack for now. We should have a separate cli option for size
                  for idx, face in faces:
                      if self.input_aligned_dir is not None and self.check_skipface(filename, idx):
                          print ('face {} for frame {} was deleted, skipping'.format(idx, os.path.basename(filename)))
                          continue
                    # Check for image rotations and rotate before mapping face
                    if face.r != 0:
                        image = rotate_image(image, face.r)
                        image = converter.patch_image(image, face, 64 if "128" not in self.arguments.trainer else 128)
                        # TODO: This switch between 64 and 128 is a hack for now. We should have a separate cli option for size
                        image = rotate_image(image, face.r * -1)
                    else:
                        image = converter.patch_image(image, face, 64 if "128" not in self.arguments.trainer else 128)
                        # TODO: This switch between 64 and 128 is a hack for now. We should have a separate cli option for size
                    # Check for image rotations and rotate before mapping face
                    if face.r != 0:
                        image = rotate_image(image, face.r)
                        image = converter.patch_image(image, face, 64 if "128" not in self.arguments.trainer else 128)
                        # TODO: This switch between 64 and 128 is a hack for now. We should have a separate cli option for size
                        image = rotate_image(image, face.r * -1)
                    else:
                        image = converter.patch_image(image, face, 64 if "128" not in self.arguments.trainer else 128)
                        # TODO: This switch between 64 and 128 is a hack for now. We should have a separate cli option for size
  
              output_file = get_folder(self.output_dir) / Path(filename).name
              cv2.imwrite(str(output_file), image)
          except Exception as e:
              print('Failed to convert image: {}. Reason: {}'.format(filename, e))
keep keep keep keep replace replace 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 
scripts/convert.py