Skip to content

Commit

Permalink
add face alginment
Browse files Browse the repository at this point in the history
  • Loading branch information
AIFSH committed Sep 16, 2024
1 parent c7806cf commit dbff026
Show file tree
Hide file tree
Showing 19 changed files with 1,040 additions and 331 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# HivisionIDPhotos-ComfyUI
a custom node for [HivisionIDPhotos](https://github.com/Zeyi-Lin/HivisionIDPhotos), you can find [证件照_workflow](./doc/证件照_workflow.json),or [id_photo_workflow](./doc/id_photo_workflow.json)
a custom node for [HivisionIDPhotos](https://github.com/Zeyi-Lin/HivisionIDPhotos), you can find [证件照_workflow](./doc/证件照_workflow.json),or [id_photo_workflow](./doc/idphoto_workflow.json)

![comfyui demo](doc/web.png)

Expand All @@ -13,6 +13,7 @@ a custom node for [HivisionIDPhotos](https://github.com/Zeyi-Lin/HivisionIDPhoto
- [一键包](https://pan.quark.cn/s/b8422210f61a)

# 🤩 最近更新
- 2024.09.16 增加**人脸旋转对齐/调整亮度、对比度、锐度**功能
- 2024.09.14 增加**自定义DPI**功能
- 2024.09.13 增加**美白**功能

Expand Down
43 changes: 40 additions & 3 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ def INPUT_TYPES(s):
"required":{
"input_img":("IMAGE",),
"normal_params":("PARAMS",),
"face_alignment":("BOOLEAN",{
"default": True
}),
"change_bg_only":("BOOLEAN",{
"default": False
}),
Expand Down Expand Up @@ -369,6 +372,34 @@ def INPUT_TYPES(s):
"step":1,
"display":"slider"
}),
"brightness_strength":("INT",{
"default": 0,
"min":-5,
"max":25,
"step":1,
"display":"slider"
}),
"contrast_strength":("INT",{
"default": 0,
"min":-10,
"max":50,
"step":1,
"display":"slider"
}),
"saturation_strength":("INT",{
"default": 0,
"min":-10,
"max":50,
"step":1,
"display":"slider"
}),
"sharpen_strength":("INT",{
"default": 0,
"min":0,
"max":5,
"step":1,
"display":"slider"
}),
}
}

Expand All @@ -381,8 +412,9 @@ def INPUT_TYPES(s):

CATEGORY = "AIFSH_HivisionIDPhotos"

def gen_img(self,input_img,normal_params,change_bg_only,crop_only,matting_model,
face_detect_model,head_measure_ratio,top_distance,whitening_strength):
def gen_img(self,input_img,normal_params,face_alignment,change_bg_only,crop_only,matting_model,
face_detect_model,head_measure_ratio,top_distance,whitening_strength,
brightness_strength,contrast_strength,saturation_strength,sharpen_strength):
creator = IDCreator()

# ------------------- 人像抠图模型选择 -------------------
Expand All @@ -400,7 +432,12 @@ def gen_img(self,input_img,normal_params,change_bg_only,crop_only,matting_model,
head_top_range=(top_distance, top_distance-0.02),
change_bg_only=change_bg_only,
crop_only=crop_only,
whitening_strength=whitening_strength)
face_alignment=face_alignment,
whitening_strength=whitening_strength,
brightness_strength=brightness_strength,
contrast_strength = contrast_strength,
sharpen_strength=sharpen_strength,
saturation_strength=saturation_strength,)
except FaceError:
print("人脸数量不等于 1,请上传单张人脸的图像。")
else:
Expand Down
Loading

0 comments on commit dbff026

Please sign in to comment.