91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 68.95MB
    文件類型: .zip
    金幣: 2
    下載: 2 次
    發布日期: 2022-12-19
  • 語言: Python
  • 標簽: Python語言??

資源簡介

基于Python的人工智能美顏系統,代碼說明見:https://blog.csdn.net/m0_38106923/article/details/93338522

資源截圖

代碼片段和文件信息

#?-*-?coding:?utf-8?-*-
“““
Created?on?Tue?Sep?12?12:36:11?2017

@author:?Quantum?Liu
“““

import?sysostraceback
import?cv2
import?dlib
import?numpy?as?np

class?NoFace(Exception):
????‘‘‘
????沒臉
????‘‘‘
????pass

class?Organ():
????def?__init__(selfim_bgrim_hsvtemp_bgrtemp_hsvlandmarknameksize=None):
????????‘‘‘
????????五官部位類
????????arguments:
????????????im_bgr:uint8?array?inference?of?BGR?image
????????????im_hsv:uint8?array?inference?of?HSV?image
????????????temp_bgr/hsv:global?temp?image
????????????landmark:array(x2)?landmarks
????????????name:string
????????‘‘‘
????????self.im_bgrself.im_hsvself.landmarkself.name=im_bgrim_hsvlandmarkname
????????self.get_rect()
????????self.shape=(int(self.bottom-self.top)int(self.right-self.left))
????????self.size=self.shape[0]*self.shape[1]*3
????????self.move=int(np.sqrt(self.size/3)/20)
????????self.ksize=self.get_ksize()
????????self.patch_bgrself.patch_hsv=self.get_patch(self.im_bgr)self.get_patch(self.im_hsv)
????????self.set_temp(temp_bgrtemp_hsv)
????????self.patch_mask=self.get_mask_re()
????????pass
????
????def?set_temp(selftemp_bgrtemp_hsv):
????????self.im_bgr_tempself.im_hsv_temp=temp_bgrtemp_hsv
????????self.patch_bgr_tempself.patch_hsv_temp=self.get_patch(self.im_bgr_temp)self.get_patch(self.im_hsv_temp)

????def?confirm(self):
????????‘‘‘
????????確認操作
????????‘‘‘
????????self.im_bgr[:]self.im_hsv[:]=self.im_bgr_temp[:]self.im_hsv_temp[:]
????
????def?update_temp(self):
????????‘‘‘
????????更新臨時圖片
????????‘‘‘
????????self.im_bgr_temp[:]self.im_hsv_temp[:]=self.im_bgr[:]self.im_hsv[:]
????????
????def?get_ksize(selfrate=15):
????????size=max([int(np.sqrt(self.size/3)/rate)1])
????????size=(size?if?size%2==1?else?size+1)
????????return?(sizesize)
????????
????def?get_rect(self):
????????‘‘‘
????????獲得定位方框
????????‘‘‘
????????ysxs=self.landmark[:1]self.landmark[:0]
????????self.topself.bottomself.leftself.right=np.min(ys)np.max(ys)np.min(xs)np.max(xs)

????def?get_patch(selfim):
????????‘‘‘
????????截取局部切片
????????‘‘‘
????????shape=im.shape
????????return?im[np.max([self.top-self.move0]):np.min([self.bottom+self.moveshape[0]])np.max([self.left-self.move0]):np.min([self.right+self.moveshape[1]])]

????def?_draw_convex_hull(selfim?points?color):
????????‘‘‘
????????勾畫多凸邊形
????????‘‘‘
????????points?=?cv2.convexHull(points)
????????cv2.fillConvexPoly(im?points?color=color)
????????
????def?get_mask_re(selfksize=None):
????????‘‘‘
????????獲得局部相對坐標遮罩
????????‘‘‘
????????if?ksize==None:
????????????ksize=self.ksize
????????landmark_re=self.landmark.copy()
????????landmark_re[:1]-=np.max([self.top-self.move0])
????????landmark_re[:0]-=np.max([self.left-self.move0])
????????mask?=?np.zeros(self.patch_bgr.shape[:2]?dtype=np.float64)
????
????????self._draw_convex_hull(mask
?????????????????????????landmark_re
?????????????????????????color=1)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-06-22?16:52??基于Python的人工智能美顏系統\
?????文件???????14624??2019-06-22?16:38??基于Python的人工智能美顏系統\AIMakeup.py
?????目錄???????????0??2019-06-22?16:37??基于Python的人工智能美顏系統\data\
?????文件????99693937??2018-08-08?17:50??基于Python的人工智能美顏系統\data\shape_predictor_68_face_landmarks.dat
?????文件??????373911??2019-06-22?16:46??基于Python的人工智能美顏系統\im.png
?????文件???????11357??2017-09-27?09:18??基于Python的人工智能美顏系統\LICENSE
?????文件??????????96??2017-09-27?09:18??基于Python的人工智能美顏系統\make.bat
?????文件????????5783??2017-09-27?09:18??基于Python的人工智能美顏系統\MakupGUI.ui
?????文件??????????82??2017-09-27?09:18??基于Python的人工智能美顏系統\README.md
?????文件???????13886??2017-09-27?09:18??基于Python的人工智能美顏系統\Ui_MakupGUI.py
?????文件?????????802??2017-09-27?09:18??基于Python的人工智能美顏系統\Ui_MakupGUI.spec
?????目錄???????????0??2019-06-22?16:39??基于Python的人工智能美顏系統\__pycache__\
?????文件???????13609??2019-06-22?16:39??基于Python的人工智能美顏系統\__pycache__\AIMakeup.cpython-36.pyc

評論

共有 條評論