예제 #1
0
def match_face(path_img1, path_img2):
    func_api = "/openapi/v1/faces/match"
    base64_img_1 = img_base(path_img1)
    base64_img_2 = img_base(path_img2)

    body = {
        "image_type": 1,
        "image_base64_1": base64_img_1,
        "face_rect_1": "107,45,183,136",
        "image_base64_2": base64_img_2,
        "face_rect_2": "145,81,312,289"
    }
    res = http_post(func_api, 'POST', body)
    res = json.loads(res)
    logger.debug(res)
    print(res['data'])
예제 #2
0
def extract_face(image_type, img_path):
    func_api = "/openapi/v1/faces/face_extract"
    base64_img = img_base(img_path)
    body = {
        "image_type": image_type,
        "image_base64": base64_img,
        "max_face_count": 1
    }
    res = http_post(func_api, 'POST', body)
    res = json.loads(res)
    logger.debug(res)
    print(res['data'])
예제 #3
0
def search_face(img_path, faceset_ids):
    func_api = "/openapi/v1/faces/search"
    base64_img_1 = img_base(img_path)

    body = {
        "image_base64": base64_img_1,
        "image_type": 1,
        "faceset_ids": faceset_ids
    }
    res = http_post(func_api, 'POST', body)
    res = json.loads(res)
    # print(res)
    # print(res['data'])
    return res['data']
예제 #4
0
def detect_face(image_type, img_path):
    func_api = "/openapi/v1/faces/detect"
    base64_img = img_base(img_path)
    body = {
        "image_type": image_type,
        "image_base64": base64_img,
        "keypoint": True,
        "quality": True,
        "attributes": "age,gender",
        "max_face_count": 10
    }
    res = http_post(func_api, 'POST', body)
    res = json.loads(res)
    logger.debug(res)
    data = res['data']
    print(data)
    return data
예제 #5
0
def user_append_img(faceset_id, face_id, image_type, img_path, age, gender):
    func_api = "/openapi/v1/facesets/" + faceset_id + "/faces/" + face_id + "/images_add"
    img_base64 = img_base(img_path)
    body = {
        "images": [{
            "image_type": image_type,
            "image_base64": img_base64
        }],
        "attributes": {
            "age": age,
            "gender": gender
        }
    }
    res = http_post(func_api, 'POST', body)
    res = json.loads(res)
    logger.debug(res)
    print(res)
    print(res['data'])
예제 #6
0
def registered_user(faceset_id, image_type, img_path, age, gender):
    func_api = "/openapi/v1/facesets/" + faceset_id + "/faces"
    base64_img = img_base(img_path)
    body = {
        "images": [
            {
                "image_type": image_type,
                "image_base64": base64_img,
            },
        ],
        "attributes": {
            "age": age,
            "gender": gender
        }
    }
    res = http_post(func_api, 'POST', body)
    res = json.loads(res)
    logger.debug(res)
    data = res['data']
    print(res)
    return data