Spaces:
Sleeping
Sleeping
Update face_parsing.py
Browse files- face_parsing.py +3 -2
face_parsing.py
CHANGED
|
@@ -165,7 +165,7 @@ def segmentation(input_img_path):
|
|
| 165 |
3. background in the person's image is black, which is messing up with hair, fix that.
|
| 166 |
"""
|
| 167 |
|
| 168 |
-
def integration_with_meme(input_img_path, face_x, face_y, face_width, face_height):
|
| 169 |
|
| 170 |
person_image = segmentation(input_img_path)
|
| 171 |
# person_image = Image.open('only_face.jpg')
|
|
@@ -186,7 +186,8 @@ def integration_with_meme(input_img_path, face_x, face_y, face_width, face_heigh
|
|
| 186 |
# Resize the person's image to fit the face region
|
| 187 |
person_resized = person_image.resize((face_width, face_height)).convert("RGBA")
|
| 188 |
|
| 189 |
-
|
|
|
|
| 190 |
|
| 191 |
person_data = np.array(person_resized)
|
| 192 |
|
|
|
|
| 165 |
3. background in the person's image is black, which is messing up with hair, fix that.
|
| 166 |
"""
|
| 167 |
|
| 168 |
+
def integration_with_meme(input_img_path, face_x, face_y, face_width, face_height, flip):
|
| 169 |
|
| 170 |
person_image = segmentation(input_img_path)
|
| 171 |
# person_image = Image.open('only_face.jpg')
|
|
|
|
| 186 |
# Resize the person's image to fit the face region
|
| 187 |
person_resized = person_image.resize((face_width, face_height)).convert("RGBA")
|
| 188 |
|
| 189 |
+
if flip:
|
| 190 |
+
person_resized = ImageOps.mirror(person_resized)
|
| 191 |
|
| 192 |
person_data = np.array(person_resized)
|
| 193 |
|