2024年最全使用 Python 为女神挑选口红,Python事件分发面试

一、Python所有方向的学习路线

Python所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照下面的知识点去找对应的学习资源,保证自己学得较为全面。

img
img

二、Python必备开发工具

工具都帮大家整理好了,安装就可直接上手!img

三、最新Python学习笔记

当我学到一定基础,有自己的理解能力的时候,会去阅读一些前辈整理的书籍或者手写的笔记资料,这些笔记详细记载了他们对一些技术点的理解,这些理解是比较独到,可以学到不一样的思路。

img

四、Python视频合集

观看全面零基础学习视频,看视频学习是最快捷也是最有效果的方式,跟着视频中老师的思路,从基础到深入,还是很容易入门的。

img

五、实战案例

纸上得来终觉浅,要学会跟着视频一起敲,要动手实操,才能将自己的所学运用到实际当中去,这时候可以搞点实战案例来学习。img

六、面试宝典

在这里插入图片描述

在这里插入图片描述

简历模板在这里插入图片描述

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

图片转 base64

pic_path = ‘/Users/xx/Desktop/kh/原图.png’

with open (pic_path, ‘rb’) as f:

base64_data = base64.b64encode(f.read())

image:图片,image_type:图片格式,face_field:请求的结果,landmark150为人脸的 150 个关键点

params = ‘{“image”:"’+base64_data.decode(‘utf-8’)+‘",“image_type”:“BASE64”,“face_field”:“landmark150”}’

request_url = ‘https://aip.baidubce.com/rest/2.0/face/v3/detect?access_token=’ + access_token

headers = {‘content-type’: ‘application/json’}

response = requests.post(request_url, data=params, headers=headers)

if response:

face = response.json()

else:

raise Exception(‘人脸关键点获取失败’)

示例结果

在这里插入图片描述

取到人脸关键点后,参照人脸识别的文档(下图)可以得到嘴唇的 48 个关键点

在这里插入图片描述

上嘴唇关键点,按顺时针方向的顺序组成一个多边形

mouth_lip_upper_point_list = [

‘mouth_corner_right_outer’,‘mouth_lip_upper_outer_1’,‘mouth_lip_upper_outer_2’,‘mouth_lip_upper_outer_3’,

‘mouth_lip_upper_outer_4’,‘mouth_lip_upper_outer_5’,‘mouth_lip_upper_outer_6’,‘mouth_lip_upper_outer_7’,

‘mouth_lip_upper_outer_8’,‘mouth_lip_upper_outer_9’,‘mouth_lip_upper_outer_10’,‘mouth_lip_upper_outer_11’,

‘mouth_corner_left_outer’,‘mouth_corner_left_inner’,‘mouth_lip_upper_inner_11’,‘mouth_lip_upper_inner_10’,

‘mouth_lip_upper_inner_9’,‘mouth_lip_upper_inner_8’,‘mouth_lip_upper_inner_7’,‘mouth_lip_upper_inner_6’,

‘mouth_lip_upper_inner_5’,‘mouth_lip_upper_inner_4’,‘mouth_lip_upper_inner_3’,‘mouth_lip_upper_inner_2’,

‘mouth_lip_upper_inner_1’,‘mouth_corner_right_inner’,‘mouth_corner_right_outer’

]

下嘴唇关键点,按顺时针方向的顺序组成一个多边形

mouth_lip_low_point_list = [

‘mouth_corner_right_outer’,‘mouth_corner_right_inner’,‘mouth_lip_lower_inner_1’,‘mouth_lip_lower_inner_2’,

‘mouth_lip_lower_inner_3’,‘mouth_lip_lower_inner_4’,‘mouth_lip_lower_inner_5’,‘mouth_lip_lower_inner_6’,

‘mouth_lip_lower_inner_7’,‘mouth_lip_lower_inner_8’,‘mouth_lip_lower_inner_9’,‘mouth_lip_lower_inner_10’,

‘mouth_lip_lower_inner_11’,‘mouth_corner_left_outer’,‘mouth_lip_lower_outer_11’,‘mouth_lip_lower_outer_10’,

‘mouth_lip_lower_outer_9’,‘mouth_lip_lower_outer_8’,‘mouth_lip_lower_outer_7’,‘mouth_lip_lower_outer_6’,

‘mouth_lip_lower_outer_5’,‘mouth_lip_lower_outer_4’,‘mouth_lip_lower_outer_3’,‘mouth_lip_lower_outer_2’,

‘mouth_lip_lower_outer_1’,‘mouth_corner_right_outer’

]

for f in face[‘result’][‘face_list’]:

上嘴唇关键点 [(x,y),(x,y),(x,y)] 元组列表

mouth_lip_upper_list = []

下嘴唇关键点 [(x,y),(x,y),(x,y)] 元组列表

mouth_lip_low_list = []

for point in mouth_lip_upper_point_list:

p = f[‘landmark150’][point]

mouth_lip_upper_list.append((p[‘x’], p[‘y’]))

for point in mouth_lip_low_point_list:

p = f[‘landmark150’][point]

mouth_lip_low_list.append((p[‘x’], p[‘y’]))

涂口红

在全网都没有找到每种口红所对应的 16 进制颜色,RGBA 的颜色也没有找到,在这里使用笨办法,在天猫上打开一个口红页面,在开发者模式下拾取颜色并复制 16 进制颜色,口红图层使用 mageDraw.Draw 模块的 polygon 函数绘制多边形并填充颜色

在这里插入图片描述

将将转为可操作的 RGBA 模式

img = Image.open(pic_path)

d = ImageDraw.Draw(img, ‘RGBA’)

口红颜色

hex = input(‘请输入口红的16进制颜色:’)

16 进制颜色转 rgba 模式

color = (int(hex[1:3], 16), int(hex[3:5], 16), int(hex[5:7], 16))

绘制多边形并填充颜色

一、Python所有方向的学习路线

Python所有方向路线就是把Python常用的技术点做整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。

二、学习软件

工欲善其事必先利其器。学习Python常用的开发软件都在这里了,给大家节省了很多时间。

三、入门学习视频

我们在看视频学习的时候,不能光动眼动脑不动手,比较科学的学习方法是在理解之后运用它们,这时候练手项目就很适合了。

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值