Merge pull request #61 from elrond79/fix/unscaled_max_image_size

when using unscaled images, don't make image larger than original
This commit is contained in:
Jeremy Hummel 2019-09-12 16:46:48 -07:00 committed by GitHub
commit 1ad626cdf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,6 +229,10 @@ class ExtractSubprocessor(Subprocessor):
face_image_size = self.image_size face_image_size = self.image_size
if face_image_size == 0 and self.face_type != FaceType.MARK_ONLY: if face_image_size == 0 and self.face_type != FaceType.MARK_ONLY:
face_image_size = LandmarksProcessor.calc_image_size_for_unscaled(image_landmarks, self.face_type) face_image_size = LandmarksProcessor.calc_image_size_for_unscaled(image_landmarks, self.face_type)
# if landmarks are bad, could get HUGE scale...
# ...so set a max size, same as input image biggest
# dimension
face_image_size = min(face_image_size, max(w,h))
if self.face_type == FaceType.MARK_ONLY: if self.face_type == FaceType.MARK_ONLY:
image_to_face_mat = None image_to_face_mat = None