A-A+
百度AI 图像无损放大 python脚本

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】
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 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from aip import AipImageProcess
import base64
""" 你的 APPID AK SK """
APP_ID = 'xxxxx'
API_KEY = 'xxxxxx'
SECRET_KEY = 'xxxxxxxxx'
client = AipImageProcess(APP_ID, API_KEY, SECRET_KEY)
""" 读取图片 """
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
image = get_file_content('123.jpg')
""" 调用图像无损放大 """
pic = client.imageQualityEnhance(image)
#print(pic)
img = base64.b64decode(pic["image"])
file = open('img.jpg', 'wb')
file.write(img)
file.close() |
更多调用脚本可参考:https://cloud.baidu.com/doc/IMAGEPROCESS/s/Uk3bcltn4
布施恩德可便相知重
微信扫一扫打赏
支付宝扫一扫打赏