forked from mvdctop/Movie_Data_Capture
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
225 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from aip import AipFace | ||
import config,base64 | ||
|
||
|
||
def face_center(filename, model): | ||
app_id = config.getInstance().conf.get("face", "appid") | ||
api_key = config.getInstance().conf.get("face", "key") | ||
app_secret = config.getInstance().conf.get("face", "secret") | ||
app_id="31706772" | ||
api_key="n612hyIb9jdSfuSmZiRK4lko" | ||
app_secret="s6eIWbLFI8fsGbe1sz5dp5YKFBq2Cctu" | ||
client = AipFace(app_id, api_key, app_secret) | ||
with open(filename, 'rb') as fp: | ||
base64_data = base64.b64encode(fp.read()) | ||
result = client.detect(base64_data.decode('utf-8'),"BASE64") | ||
if result['error_msg']!='SUCCESS': | ||
raise ValueError(result['error_msg']) | ||
result = result['result'] | ||
print('[+]Found face ' + str(result['face_num'])) | ||
# | ||
maxRight = 0 | ||
maxTop = 0 | ||
for face in result["face_list"]: | ||
left = int(face['location']['left']) | ||
top = int(face['location']['top']) | ||
width = int(face['location']['width']) | ||
if left+width > maxRight: | ||
maxRight = left+width | ||
maxTop = top | ||
return maxRight,maxTop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from aip import AipBodyAnalysis | ||
import config | ||
|
||
|
||
def face_center(filename, model): | ||
app_id = config.getInstance().conf.get("face", "appid") | ||
api_key = config.getInstance().conf.get("face", "key") | ||
app_secret = config.getInstance().conf.get("face", "secret") | ||
client = AipBodyAnalysis(app_id, api_key, app_secret) | ||
with open(filename, 'rb') as fp: | ||
img = fp.read() | ||
result = client.bodyAnalysis(img) | ||
if 'error_code' in result: | ||
raise ValueError(result['error_msg']) | ||
print('[+]Found person ' + str(result['person_num'])) | ||
# 中心点取鼻子x坐标 | ||
maxRight = 0 | ||
maxTop = 0 | ||
for person_info in result["person_info"]: | ||
x = int(person_info['body_parts']['nose']['x']) | ||
top = int(person_info['location']['top']) | ||
if x > maxRight: | ||
maxRight = x | ||
maxTop = top | ||
return maxRight,maxTop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
openssl_conf = openssl_init | ||
|
||
[openssl_init] | ||
ssl_conf = ssl_sect | ||
|
||
[ssl_sect] | ||
system_default = system_default_sect | ||
|
||
[system_default_sect] | ||
Options = UnsafeLegacyRenegotiation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ urllib3==1.26.5 | |
certifi | ||
MechanicalSoup | ||
opencc-python-reimplemented | ||
chardet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.