-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (22 loc) · 751 Bytes
/
main.py
File metadata and controls
30 lines (22 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from hair_segmentation import FaceHairSegmentation
import cv2
def process_image(image_path):
# 인스턴스 생성
segmenter = FaceHairSegmentation()
# 이미지 로드
image = cv2.imread(image_path)
image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
# 얼굴 감지
faces = segmenter.detect_faces(image_rgb)
# 얼굴별로 처리
for face in faces:
image = segmenter.process_face(image, face)
return image
if __name__ == "__main__":
image_path = "images/test1.jpeg"
# 이미지 처리
processed_image = process_image(image_path)
# 결과 이미지 출력
cv2.imshow('Face Mesh with Expanded Hair Segmentation', processed_image)
cv2.waitKey(0)
cv2.destroyAllWindows()