- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
import face_recognition
import cv2
import os, os.path
import numpy as np
count = 0
def finding_members():
finding_members.list= os.listdir('/Users/apple/Desktop/face_id/train_models')
print(finding_members.list)
video_capture = cv2.VideoCapture(0)
count = 0
count1 = 0
encoding_name = str()
face_encoding = []
length_of_encoding = 0
length_of_encodings = 0
name_face_encodings = []
names = []
for i in finding_members.list:
findDot = i.find('.')
finding_members.name = i[0:findDot]
if ((len(finding_members.name)) > 1):
names.append(finding_members.name)
print(names)
for i in finding_members.list:
dit = "train_models/"+i
print(dit)
if (i != ".DS_Store"):
images = face_recognition.load_image_file(dit)
findDot = i.find('.')
encoding_name = i[0:findDot]
if (length_of_encodings >= 0):
name_face_encodings.append(face_encoding)
face_encoding = [face_recognition.face_encodings(images)[0]]
length_of_encoding = len(face_encoding)
#face_encoding.update(face_encoding)
print(len(name_face_encodings))
count = count+1
print (count)
while True:
#cv2.imshow('Video', frame)
ret, frame = video_capture.read()
cv2.imshow('video1',frame)
face_locations = face_recognition.face_locations(frame)
face_encodings = face_recognition.face_encodings(frame, face_locations)
#for
for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
for paru in names:
print(len(name_face_encodings))
print(count1)
local_encoding = name_face_encodings[count1]
match = face_recognition.compare_faces([local_encoding], face_encoding)
count1 = count1 + 1
name = "Unknown"
print(count1)
print(names[count1])
if (match ==True):
name = names[count1]
cv2.rectangle(frame, (left, top), (right, bottom), (100, 40, 100), 2)
font = cv2.FONT_HERSHEY_DUPLEX
cv2.putText(frame, name, (left + 6, top - 6), font, 1.0, (255, 255, 255), 1)
print(names)
#print(len())
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
video_capture.release()
cv2.destroyAllWindows()
finding_members()
print(finding_members.list)
print(finding_members.name)
ValueError: operands could not be broadcast together with shapes (1,0) (128,)
error = match = face_recognition.compare_faces([local_encoding], face_encoding
how to get rid of these error i think comes due to numpy indexingmatch = face_recognition.compare_faces([local_encoding], face_encoding)
File "/Users/apple/anaconda3/envs/face_id/lib/python3.6/site-packages/face_recognition/api.py", line 203, in compare_faces
最佳答案
如果我没理解错的话,
video_captured 帧是 BGR,因此帧将其转换为 RGB。
rgb_frame = frame[:, :, ::-1]
face_locations = face_recognition.face_locations(rgb_frame)
关于opencv - 由于 numpy 在 face_recognition 中发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47487300/
我是编程新手。我已将 dlib 添加到我的 xcode 项目中,如示例中所示 https://github.com/zweigraf/face-landmarking-ios .而且效果很好。 如何添
我正在同时使用开放式简历和人脸识别,但是下面这行代码: biden_encoding = face_recognition.face_encodings(known_image)[0] 给我以下错误:
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭5 年前。 Improve this quest
import face_recognition image = face_recognition.load_image_file("My_Image.png") face_locations = fa
我正在探索 python 中的 face_recognition https://github.com/ageitgey/face_recognition 目前,我将 face_encoding 存储
我在 Google Colab 工作并且已经导入了 dlib !pip install dlib import dlib 并安装了face_recognition模块。 !pip install fa
我尝试使用 "conda install face_recognition -c conda-forge face_recognition" 安装 face_recognition 包 并遇到以下错误
我有face_recognition python脚本,如果执行可以正常运行,但是如果执行则随机显示错误: Traceback (most recent call last): File
我正在尝试制作一个可以用图像填充眼睛的眼睛替换程序。为了找到眼睛,我使用了 Ageitgey 的 face_recognition。然而,眼睛检测结果非常参差不齐。 (我不是在谈论抗锯齿,顺便说一句。
import face_recognition import cv2 import os, os.path import numpy as np count = 0 def finding_membe
我是 PyCharm 新手,正在尝试一些面部识别功能。我的工作需要一个face_recogniton库,它是使用以下命令安装的(我使用Ubuntu 18.04作为我的操作系统): pip instal
我使用 face_recognition 模块进行编程,当我尝试为 Windows 制作 .exe 文件时,它不起作用。也许 smb 可以告诉我该怎么做? 最佳答案 从这里下载文件 shape_pre
我已经有了 dlib 19.1.0 并打开了 cv 3.4.5 和 numpy,scipy 高级版本的包,但是使用 pip install face_recognition 我收到以下错误..请任何人
我是一名优秀的程序员,十分优秀!