添加多角度识别
This commit is contained in:
@@ -241,13 +241,18 @@ def photo_mask(pk_phhd, content):
|
|||||||
split_result = split_image(image)
|
split_result = split_image(image)
|
||||||
for img in split_result:
|
for img in split_result:
|
||||||
angles = get_image_rotation_angles(img["img"])
|
angles = get_image_rotation_angles(img["img"])
|
||||||
rotated_img = rotate_image(img["img"], int(angles[0]))
|
angle = int(angles[0])
|
||||||
|
rotated_img = rotate_image(img["img"], angle)
|
||||||
|
results = get_mask_layout(rotated_img, content)
|
||||||
|
if not results:
|
||||||
|
angle = int(angles[1])
|
||||||
|
rotated_img = rotate_image(img["img"], angle)
|
||||||
results = get_mask_layout(rotated_img, content)
|
results = get_mask_layout(rotated_img, content)
|
||||||
|
|
||||||
for result in results:
|
for result in results:
|
||||||
height, width = img["img"].shape[:2]
|
height, width = img["img"].shape[:2]
|
||||||
center = (width / 2, height / 2)
|
center = (width / 2, height / 2)
|
||||||
result = rotate_rectangle(result, center, int(angles[0]))
|
result = rotate_rectangle(result, center, angle)
|
||||||
result = (
|
result = (
|
||||||
result[0] + img["x_offset"],
|
result[0] + img["x_offset"],
|
||||||
result[1] + img["y_offset"],
|
result[1] + img["y_offset"],
|
||||||
|
|||||||
Reference in New Issue
Block a user