Skip to content

Seungeun-Han/Real-time-Face-Detect-and-Align-from-WebCam

Repository files navigation

Real-time Face Detection and Alignment from WebCam

Explain about this Repository

웹캠으로부터 영상을 가져와서 얼굴을 검출하는 코드입니다.

Face Detection을 위해 RetinaFace를 사용했으며, Face Alignment 방식은 Insightface 방식을 참고하였습니다.

추가적으로, 자동 밝기 및 대비 조절을 위해 Gamma Correction 과 Constrast Normalization 연산을 추가하였습니다.


Face_Detection

  • face_detect.py
  • real-time으로 face를 detect하는 코드입니다..
  • face와 left eye에 대한 bounding box 출력
  • left/right eye, nose, left/right mouth 포인트 출력 (5 landmarks)
  • detect 결과를 face_detect_result.jpg로 저장
  • Retinaface, mobilenet0.25 사용

Result

detect_result


Face_Alignment.py

  • face_alignment.py
  • real-time으로 face를 align하는 코드입니다.
  • insightface의 align 방식을 참고하였습니다.
  • align 후 size는 473X473 입니다.
  • align 후엔 웹캠에서 읽어오는 얼굴이 기울어지거나, 멀거나 가까워져도 5개의 landmark의 위치는 변하지 않습니다.

Result

Before Apply Alignment

before_alignment_2

After Apply Alignment

after_alignment_3

얼굴이 기울어지거나 멀어져도 landmarks의 위치는 변하지 않는 것을 볼 수 있습니다.


GammaCorrection_and_ContrastNormalization

  • gammaCorrection_and_ContrastNormalization.py
  • real-time으로 영상을 보정하는 코드입니다.
  • Gamma Correction 연산을 통해 Gamma 값을 계산하여 밝기를 적절하게 조정합니다.
  • Contrast Normalization 연산을 통해 대비를 적절하게 조정합니다.

Result

Before

before_gc

After

after_gc


Reference

Retinaface

face alignment

https://github.com/deepinsight/insightface

About

real time face detection and alignment.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages