Esempio n. 1
0
def test_t(a, b):
    from qcloud_image import Client
    from qcloud_image import CIUrl, CIFile, CIBuffer, CIUrls, CIFiles, CIBuffers
    appid = cf.get("qq", "appid")
    secret_id = cf.get("qq", "secret_id")
    secret_key = cf.get("qq", "secret_key")
    bucket = 'BUCKET'
    client = Client(appid, secret_id, secret_key, bucket)
    client.use_http()
    client.set_timeout(30)

    print("compare {} and {}".format(a, b))

    print(client.face_compare(CIFile(a), CIFile(b)))
Esempio n. 2
0
        'person111',
        CIUrl('http://img3.a0bi.com/upload/ttq/20160814/1471155260063.png')))
#人脸验证,单个图片file
print(client.face_verify('person111', CIFile('./test.jpg')))

#人脸检索,单个文件url
print(
    client.face_identify(
        'group1',
        CIUrl('http://www.5djiaren.com/uploads/2016-07/22-141354_227.jpg')))
##人脸检索,单个文件file
print(client.face_identify('group2', CIFile('./test.jpg')))

#人脸对比
#两个对比图片的文件url
print(client.face_compare(CIFile('./zhao1.jpg'), CIFile('./zhao2.jpg')))
#两个对比图片的文件file
print(
    client.face_compare(
        CIUrl(
            'http://www.miexue.com/d/file/junshiyingshi/2016-12-05/60bce03aac7a57e4fc600ecee1591e1d.jpg'
        ),
        CIUrl(
            'http://img.mp.itc.cn/upload/20161118/ee6be67ec6fb4135b5d579ab05acd715_th.jpg'
        )))
#一个是图片的文件url, 一个是对比图片的文件file
print(
    client.face_compare(
        CIFile('./zhao1.jpg'),
        CIUrl(
            'http://www.miexue.com/d/file/junshiyingshi/2016-12-05/60bce03aac7a57e4fc600ecee1591e1d.jpg'