日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python模块cv2人脸识别_python face_recognition模块实现人脸识别

發布時間:2024/10/14 python 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python模块cv2人脸识别_python face_recognition模块实现人脸识别 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

import face_recognition #人臉識別庫 pip cmake dlib

import cv2

#讀取圖像

face_image1 = face_recognition.load_image_file("1.jpg")

face_image2 = face_recognition.load_image_file("2.jpg")

# print(face_image)

face_encoding1 = face_recognition.face_encodings(face_image1)

face_encoding2 = face_recognition.face_encodings(face_image2)

face_location1 = face_recognition.face_locations(face_image1)

face_location2 = face_recognition.face_locations(face_image2)

# print(face_encoding1,face_encoding2)

results= face_recognition.compare_faces([face_encoding1[0]],face_encoding2[0],tolerance=0.5)

# print(results)

top,right,bottom,left = face_location2[0]

cv2.rectangle(face_image2,(left,top),(right,bottom),(0,255,0),2)

cv2.putText(face_image2,"xinyuuliu",(left-10,top-10),cv2.FONT_HERSHEY_SIMPLEX,0.8,(255,0,0),2)

#繪圖

face_image_rgb = cv2.cvtColor(face_image2,cv2.COLOR_BGR2RGB)

cv2.imshow("Output",face_image_rgb)

cv2.imwrite("result.jpg",face_image_rgb,[int(cv2.IMWRITE_JPEG_QUALITY),100])

cv2.waitKey(0)

總結

以上是生活随笔為你收集整理的python模块cv2人脸识别_python face_recognition模块实现人脸识别的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。