成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

Python實現識別圖片中的所有人臉并顯示出來

開發 后端 人臉識別
本文介紹一下使用Python3實現識別圖片中的所有人臉并顯示出來,讓我們一起來看一下。

 使用Python3實現識別圖片中的所有人臉并顯示出來,代碼如下: 

  1. # -*- coding: utf-8 -*-  
  2. #  識別圖片中的所有人臉并顯示出來  
  3. # filename : find_faces_in_picture.py  
  4. from PIL import Image  
  5. import face_recognition  
  6. # 將jpg文件加載到numpy 數組中  
  7. image = face_recognition.load_image_file("linuxidc.com.jpg")  
  8. # 使用默認的給予HOG模型查找圖像中所有人臉  
  9. # 這個方法已經相當準確了,但還是不如CNN模型那么準確,因為沒有使用GPU加速  
  10. # 另請參見: find_faces_in_picture_cnn.py  
  11. face_locations = face_recognition.face_locations(image)  
  12. # 使用CNN模型  
  13. face_locations = face_recognition.face_locations(image, number_of_times_to_upsample=0model="cnn" 
  14. # 打印:我從圖片中找到了 多少 張人臉  
  15. print("I found {} face(s) in this photograph.".format(len(face_locations)))  
  16. # 循環找到的所有人臉  
  17. for face_location in face_locations:  
  18.         # 打印每張臉的位置信息  
  19.         top, right, bottom, left = face_location  
  20.         print("A face is located at pixel location Top: {}, Left: {}, Bottom: {}, Right: {}".format(top, left, bottom, right))  
  21. # 指定人臉的位置信息,然后顯示人臉圖片  
  22.         face_image = image[top:bottom, left:right]  
  23.         pil_image = Image.fromarray(face_image)  
  24.         pil_image.show()  
  1. # 或者執行python文件  
  2. $ python3 www.linuxidc.com.py 

從圖片中識別出10張人臉,并顯示出來。 

  1. I found 10 face(s) in this photograph.  
  2. A face is located at pixel location Top: 445, Left: 1867, Bottom: 534, Right: 1957  
  3. A face is located at pixel location Top: 544, Left: 643, Bottom: 619, Right: 718  
  4. A face is located at pixel location Top: 478, Left: 1647, Bottom: 553, Right: 1722  
  5. A face is located at pixel location Top: 504, Left: 126, Bottom: 594, Right: 215  
  6. A face is located at pixel location Top: 536, Left: 395, Bottom: 611, Right: 469  
  7. A face is located at pixel location Top: 544, Left: 1042, Bottom: 619, Right: 1116  
  8. A face is located at pixel location Top: 553, Left: 818, Bottom: 627, Right: 892  
  9. A face is located at pixel location Top: 511, Left: 1431, Bottom: 586, Right: 1506  
  10. A face is located at pixel location Top: 564, Left: 1227, Bottom: 626, Right: 1289  
  11. A face is located at pixel location Top: 965, Left: 498, Bottom: 1017, Right: 550 

如下圖:

 

 

責任編輯:龐桂玉 來源: Linux公社
相關推薦

2019-04-15 13:39:10

容器開發Docker

2013-08-27 13:59:05

微軟鮑爾默

2019-12-24 19:36:45

人工智能Windows軟件

2024-03-25 09:03:07

Redis開源開發

2013-12-09 10:16:03

Android firAndroid開發移動創業

2021-11-07 14:31:52

PythonWeb頁面

2022-05-16 19:53:15

Pythongif動圖

2011-03-03 09:47:00

2019-10-17 14:07:43

技術云計算Docker

2013-06-18 09:40:29

BYOD誤解

2020-02-20 16:42:40

云端Kubernetes容器

2018-07-16 16:39:00

數據

2011-10-21 15:33:45

Dart

2022-08-11 11:20:49

Python詞云圖

2009-10-15 20:46:12

LifeSize Pa網真LifeSize

2021-12-08 18:50:19

機器人人工智能AI

2022-06-28 10:03:56

CentOSLinux

2025-06-25 08:30:56

2020-04-14 10:11:06

華為
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 亚洲国产欧美精品 | 日韩精品久久一区二区三区 | 精品91av| 国产精品久久久久久 | 欧美在线一区二区视频 | 国产色婷婷精品综合在线播放 | 中文一区| 最新毛片网站 | 成人在线视频观看 | 久草青青草 | 日韩成人久久 | 国产午夜精品一区二区三区四区 | 狠狠草视频 | 蜜桃在线播放 | 欧美一级大片 | 少妇精品亚洲一区二区成人 | 欧美bondage紧缚视频 | 日韩精品不卡 | 欧美综合一区二区三区 | 免费特黄视频 | 在线91| 欧美黄 片免费观看 | 午夜成人在线视频 | 久久久高清 | 精品视频一区二区三区在线观看 | 精品91久久 | 国产成人啪免费观看软件 | 日韩成人免费视频 | 国产精品99久久久久久久vr | 99久久99 | 不卡欧美 | 亚洲欧美日韩在线 | 中文字幕在线第一页 | 九九av| 亚洲成人精品久久久 | 亚洲一区二区三区在线 | 美女爽到呻吟久久久久 | 国产精品久久一区 | 免费黄色片在线观看 | 91精品国产综合久久国产大片 | 亚洲永久免费观看 |