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

  • 大小: 74.01MB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2022-12-05
  • 語言: Python
  • 標簽: python??dlib??

資源簡介

基于python和dlib編寫的人臉對齊程序。包含了兩個測試模型(人臉特征點68點檢測和5點檢測的模型),還有測試圖片。詳細可以參考博客:http://blog.csdn.net/hongbin_xu/article/details/78511292

資源截圖

代碼片段和文件信息


#?coding:?utf-8

#?In[2]:


import?cv2
import?dlib
import?sys
import?numpy?as?np
import?os


#?In[5]:


current_path?=?os.getcwd()
#?current_path


#?In[10]:


predicter_path?=?current_path?+?‘/model/shape_predictor_5_face_landmarks.dat‘#?檢測人臉特征點的模型放在當前文件夾中
#?predicter_path?=?current_path?+?‘/model/shape_predictor_68_face_landmarks.dat‘
face_file_path?=?current_path?+?‘/faces/inesta.jpg‘#?要使用的圖片,圖片放在當前文件夾中
print?predicter_path
print?face_file_path


#?In[11]:


detector?=?dlib.get_frontal_face_detector()
sp?=?dlib.shape_predictor(predicter_path)


#?In[12]:


bgr_img?=?cv2.imread(face_file_path)
if?bgr_img?is?None:
????print(“Sorry?we?could?not?load?‘{}‘?as?an?image“.format(face_file_path))
????exit()


#?In[15]:


rgb_img?=?cv2.cvtColor(bgr_img?cv2.COLOR_BGR2RGB)
dets?=?detector(rgb_img?1)


#?In[16]:


num_faces?=?len(dets)
if?num_faces?==?0:
????print(“Sorry?there?were?no?faces?found?in?‘{}‘“.format(face_file_path))
????exit()


#?In[18]:


faces?=?dlib.full_object_detections()
for?det?in?dets:
????faces.append(sp(rgb_img?det))


#?In[19]:


images?=?dlib.get_face_chips(rgb_img?faces?size=320)
image_cnt?=?0
for?image?in?images:
????image_cnt?+=?1
????cv_rgb_image?=?np.array(image).astype(np.uint8)
????cv_bgr_image?=?cv2.cvtColor(cv_rgb_image?cv2.COLOR_RGB2BGR)
????cv2.imshow(‘%s‘%(image_cnt)?cv_bgr_image)


#?In[20]:


cv2.waitKey(0)
cv2.destroyAllWindows()


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-11-12?13:01??face_alignment\
?????目錄???????????0??2017-11-12?12:59??face_alignment\.ipynb_checkpoints\
?????文件????????3835??2017-11-12?12:58??face_alignment\.ipynb_checkpoints\face_alignment.py-checkpoint.ipynb
?????文件????????1464??2017-11-12?13:29??face_alignment\face_alignment.py
?????文件????????3835??2017-11-12?12:59??face_alignment\face_alignment.py.ipynb
?????目錄???????????0??2017-11-12?13:11??face_alignment\faces\
?????文件???????25862??2017-11-12?13:11??face_alignment\faces\inesta.jpg
?????文件???????11933??2017-09-15?22:42??face_alignment\faces\jobs.jpg
?????文件???????17660??2017-11-12?13:03??face_alignment\faces\messi.jpg
?????文件???????35925??2017-09-15?21:19??face_alignment\faces\obama.jpg
?????文件???????54033??2017-09-15?19:57??face_alignment\faces\silicon_valley.jpg
?????目錄???????????0??2017-11-12?13:29??face_alignment\model\
?????文件?????9150489??2017-11-12?13:29??face_alignment\model\shape_predictor_5_face_landmarks.dat
?????文件????99693937??2017-03-09?08:34??face_alignment\model\shape_predictor_68_face_landmarks.dat

評論

共有 條評論