File size: 597 Bytes
ca46a75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
@DATE: 2024/9/5 21:39
@File: create_id_photo.py
@IDE: pycharm
@Description:
    用于测试创建证件照
"""
from hivision.creator import IDCreator
import cv2
import os

now_dir = os.path.dirname(__file__)
image_path = os.path.join(os.path.dirname(now_dir), "app", "images", "test.jpg")
output_dir = os.path.join(now_dir, "temp")

image = cv2.imread(image_path)
creator = IDCreator()
result = creator(image)
cv2.imwrite(os.path.join(output_dir, "result.png"), result.standard)
cv2.imwrite(os.path.join(output_dir, "result_hd.png"), result.hd)