-
Notifications
You must be signed in to change notification settings - Fork 42
/
sample.py
129 lines (97 loc) · 4.08 KB
/
sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# -*- coding: utf-8 -*-
import time
import TencentYoutuyun
# pip install requests
# please get these values from http://open.youtu.qq.com
appid = 'xxxxxx'
secret_id = 'xxxxxx'
secret_key = 'xxxxxx'
userid = 'xxxxxx'
#choose a end_point
#end_point = TencentYoutuyun.conf.API_TENCENTYUN_END_POINT
#end_point = TencentYoutuyun.conf.API_YOUTU_VIP_END_POINT
end_point = TencentYoutuyun.conf.API_YOUTU_END_POINT
youtu = TencentYoutuyun.YouTu(appid, secret_id, secret_key, userid, end_point)
session_id = ""
#for TencentYoutuyun.conf.API_YOUTU_VIP_END_POINT end_point
#get four-character idioms
#retlivegetfour = youtu.livegetfour(session_id)
#print retlivegetfour
#four-character live detect without face compare
#retlivedetectfour = youtu.livedetectfour('1122', 'xxx.mp4', session_id)
#print retlivedetectfour
#four-character live detect with face compare
#retlivedetectfour= youtu.livedetectfour('1122', 'xxx.mp4', session_id, 'xxx.jpg', True)
#print retlivedetectfour
#four-character idcard live detect
#retidcardlivedetectfour = youtu.idcardlivedetectfour('123456789987654321', '张三', '1122', 'xxx.mp4', session_id )
#print retidcardlivedetectfour
#idcard face compare: use local image compare with id card image
#retidcardfacecompare = youtu.idcardfacecompare('123456789987654321', '张三', 'xxx.jpg', 0, session_id)
#print retidcardfacecompare
#idcard face compare :use url image compare with id card image
#retidcardfacecompare = youtu.idcardfacecompare('123456789987654321', '张三', 'http://xxx.png', 1, session_id)
#print retidcardfacecompare
# face compare : use two local image to compare
#retfacecompare = youtu.FaceCompare('xxx.jpg', 'xxx.jpg')
#print retfacecompare
# face compare : use two url image to compare
#retfacecompare = youtu.FaceCompare('http://xxx.png', 'http://xxx.png', 1)
#print retfacecompare
#id card ocr: use local id card image
retidcardocr = youtu.idcardocr('./idcard_1.jpg', data_type = 0, card_type = 2)
print retidcardocr
#id card ocr: use url id card image
#retidcardocr = youtu.idcardocr('http://xxx.jpg', data_type = 1, card_type = 0)
#print retidcardocr
#driver license ocr: use local image
#retdriverlicenseocr = youtu.driverlicenseocr('dlocrattach.jpg', data_type = 0, proc_type = 2)
#print retdriverlicenseocr
#business card ocr: use local image
#retbcocr = youtu.bcocr('blocr.jpg', data_type = 0)
#print retbcocr
#general ocr: use local image
#retgeneralocr = youtu.generalocr('ge.jpg', data_type = 0)
#print retgeneralocr
#creditcard ocr: use local image
#retcreditcardocr = youtu.creditcardocr('ccard.jpg', data_type = 0)
#print retcreditcardocr
#bizlicense ocr: use local image
#bizlicenseocr = youtu.bizlicenseocr('bzocr.jpg', data_type = 0)
#print bizlicenseocr
#passport ocr: use local image
#passportocr = youtu.passportocr('passport.jpg', data_type = 0, ocr_template='PassPort')
#print passportocr
#structure ocr: use local image
#structureocr = youtu.structureocr('vat.jpg', data_type = 0, ocr_template='VAT')
#print structureocr
#invoice ocr: use local image
#invoiceocr = youtu.invoiceocr('vat.jpg', data_type = 0, ocr_template='VAT')
#print invoiceocr
#waybill ocr: use local image
#waybillocr = youtu.waybillocr('waybill.jpg', data_type = 0)
#print waybillocr
#hpgeneral ocr: use local image
#hpgeneralocr = youtu.hpgeneralocr('ge.jpg', data_type = 0)
#print hpgeneralocr
#table ocr: use local image
#tableocr = youtu.tableocr('table.png', data_type = 0)
#print tableocr
#arithmetic ocr: use local image
#arithmeticocr = youtu.arithmeticocr('arithmatic.jpg', data_type = 0)
#print arithmeticocr
#finan ocr: use local image
#financocr = youtu.finanocr('jzd.jpg', data_type = 0, ocr_template='BankInSlip')
#print financocr
#vin ocr: use local image
#vinocr = youtu.vinocr('vin.png', data_type = 0)
#print vinocr
#handwriting ocr: use local image
#handwritingocr = youtu.handwritingocr('hw.jpg', data_type = 0)
#print handwritingocr
#eh ocr: use local image
#ehocr = youtu.ehocr('eh.jpg', data_type = 0)
#print ehocr
#id card validate: validate the idcard is correct
#retvalidateidcard = youtu.ValidateIdcard('123456789987654321', '张三', session_id)
#print retvalidateidcard