Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low Quality Faces (blurry) after detecting and cv2.warpalign faces using Facexlib #40

Open
humayun opened this issue Jul 13, 2023 · 2 comments

Comments

@humayun
Copy link

humayun commented Jul 13, 2023

I am using Facexlib library to detect, crop (warpalign) and resize (512x512) the faces from photographic images (high resolutions 4K or above). In some cases, the output images are low quality even though faces is bigger in size more than 1Kx1K resolutions. Here is code in Facexlib library for detecting and cv2.warpalign the faces:

self.face_helper.read_image(img)
# get face landmarks for each face
self.face_helper.get_face_landmarks_5(only_center_face=only_center_face, eye_dist_threshold=5)
# eye_dist_threshold=5: skip faces whose eye distance is smaller than 5 pixels
# align and warp each face
self.face_helper.align_warp_face()

here is link for these function: Face Detection using Facexlib

Below is Detected Image. (https://i.stack.imgur.com/VNNky.png)

Original Image is here (can not upload here as size is bigger)

How can I detect and crop (warp and align) faces from high resolution images ? I tried different interpolation method, but there is no difference in image quality. I tried following interpolation methods: cv2.INTER_NEAREST cv2.INTER_LINEAR cv2.INTER_AREA cv2.INTER_CUBIC cv2.INTER_LANCZOS4

I tried multiple interpolation techniques in cv2.warpalign method as flags, but no difference in image quality.

@woctezuma
Copy link
Contributor

woctezuma commented Jul 13, 2023

What is the issue with the detected image?

  • Is it that the face crop does not suit your needs?
  • Or is it that you find the image blurry? I don't see it as blurry, but maybe I am missing something.

@humayun
Copy link
Author

humayun commented Jul 13, 2023

Image is low quality, even though if we crop the face area and downsample it with cv2.resize, its image quality is slightly better than this method. But still there is issue.

Here is [detected, crop and align Face] (https://i.stack.imgur.com/VNNky.png) image crop and align at 512 and

Crop and Align Face at 1024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants