日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Python實(shí)現(xiàn)識別圖片中的所有人臉并顯示出來

 使用Python3實(shí)現(xiàn)識別圖片中的所有人臉并顯示出來,代碼如下:

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、外貿(mào)營銷網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的西疇網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

 
 
 
 
  1. # -*- coding: utf-8 -*- 
  2. #  識別圖片中的所有人臉并顯示出來 
  3. # filename : find_faces_in_picture.py 
  4. from PIL import Image 
  5. import face_recognition 
  6. # 將jpg文件加載到numpy 數(shù)組中 
  7. image = face_recognition.load_image_file("linuxidc.com.jpg") 
  8. # 使用默認(rèn)的給予HOG模型查找圖像中所有人臉 
  9. # 這個(gè)方法已經(jīng)相當(dāng)準(zhǔn)確了,但還是不如CNN模型那么準(zhǔn)確,因?yàn)闆]有使用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=0, model="cnn") 
  14. # 打?。何覐膱D片中找到了 多少 張人臉 
  15. print("I found {} face(s) in this photograph.".format(len(face_locations))) 
  16. # 循環(huán)找到的所有人臉 
  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. # 或者執(zhí)行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

如下圖:


當(dāng)前名稱:Python實(shí)現(xiàn)識別圖片中的所有人臉并顯示出來
文章位置:http://m.5511xx.com/article/ccciigi.html