feat 新增人脸识别 中心点检测

This commit is contained in:
zchen
2024-04-26 15:37:16 +08:00
parent 27d96a80b9
commit 0c2cf1ec02
2 changed files with 14 additions and 8 deletions

View File

@@ -85,17 +85,17 @@ class GenerateImage:
image_result = cv2.cvtColor(np.squeeze(image.astype(np.uint8)), cv2.COLOR_RGB2BGR)
is_smudge = True
if self.category == "sketch":
# 色阶调整
cutoff = 1
levels_img = autoLevels(image_result, cutoff)
# 亮度调整
luminance = luminance_adjust(0.3, levels_img)
# 去背景
remove_bg_image = remove_background(luminance)
# 人脸检测
if face_detect_pic(image_result) > 0:
if face_detect_pic(remove_bg_image) > 0:
is_smudge = False
else:
# 色阶调整
cutoff = 1
levels_img = autoLevels(image_result, cutoff)
# 亮度调整
luminance = luminance_adjust(0.3, levels_img)
# 去背景
remove_bg_image = remove_background(luminance)
# 污点/
is_smudge, not_smudge_image = stain_detection(remove_bg_image)
# 类型识别

View File

@@ -263,6 +263,12 @@ def face_detect_pic(image):
# 3、检测人脸用灰度图检测返回人脸矩形坐标(4个角)
faces_rect = face_detector.detectMultiScale(gray, 1.05, 3)
if DEBUG:
dst = image.copy()
for x, y, w, h in faces_rect:
cv2.rectangle(dst, (x, y), (x + w, y + h), (0, 0, 255), 3) # 画出矩形框
cv2.imshow("", dst)
cv2.waitKey(0)
return len(faces_rect)