FACE RECOGNITION + ATTENDANCE PROJECT | OpenCV Python | Computer Vision
Why Stack Overflow recommends it
Stack Overflow users link it as the tutorial they followed (or recommend) for live webcam face recognition with face_recognition and OpenCV, and many of the questions are errors hit while following its code.
Recommended by 2 people across 2 different months, 2020 to 2023.
What it is
A 52-minute hands-on tutorial by Murtaza Hassan that explains face recognition with the Python face_recognition library and OpenCV, then builds a webcam attendance system that logs recognised people to an Excel/CSV sheet in real time.
What people said
Recommends Prakash Dahal · 2021-05 · Stack Overflow · on “TypeError: __init__(): incompatible constructor arguments with face_recognition call”
@SaxTed I have updated my code which will create a new file `result.jpg`. If you want to detect and recognize faces from live camera, this video might help [this video]
Recommends SHYAM SHEEL · 2021-06 · Stack Overflow · on “Not able to download dlib using pip3 or Pip”
I faced the same issue so what I did I preferred youtube and watched in one video I am sharing the link to that video that might help Video Link [this video] for short I download visual studio downloader and installed C++ dependencies and first I installed CMake then dlib because dlib takes C++ dependencies then I choose the specified version of dlib and it worked fine but if still, it doesn't work so again I would recommend using conda environment in conda it works properly but make sure to use basic dependencies (C++ and Cmake)
Cites Abdullah Mahran · 2020-12 · Stack Overflow · on “Why does my pycharm code give "list index out of range" ? I'm following the youtuber”
I'm doing a face-recognition code, at first I followed the [this video] done by Murtaza and it worked but when I tried to do it by my own I fell in that problem and couldn't solve it yet, Here is the code: while True: success, img = webcam.read() imgS = cv2.resize(img, (0, 0), None, 0.25, 0.25) imgS = cv2.cvtColor(imgS, cv2.COLOR_BGR2RGB) imgSLocs = face_recognition.face_locations(imgS) imgSEncodes = face_recognition.face_encodings(imgS, imgSLocs) for encode, loc in zip(imgSEncodes, imgSLocs): compare = face_recognition.compare_faces(refEncodes, encode) faceDist = face_recognition.face_distance(refEncodes, encode) print(faceDist) matchindex = np.argmin(faceDist) print (matchindex) if compare[matc
Cites blizzadr · 2022-11 · Stack Overflow · on “face_recognition python operands could not be broadcast together with shapes”
fellows Googled before decided to ask by myself. Trying to recieve true or falls, but unfortunately recieving an error. Doing as [this video] says My code: ` import cv2 import numpy as np import face_recognition import os path = 'ImageAttendance' # создаем список файлов myList = os.listdir(path) images = [] classNames = [] print(myList) # берем имя под каждый файл по порядку for cl in myList: curImg = cv2.imread(f'{path}/{cl}') images.append(curImg) classNames.append(os.path.splitext(cl)[0]) print (classNames) # ищем все расстояния на всех фотках и составляем список def findEncodings(images): encodeList = [] for img in images: img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) encode = face_recognition.f
Cites The Lord · 2022-11 · Stack Overflow · on “My code throws an IndexError: list index out of range”
The following code is throwing indexError list index out of range I tried googling it and everybody is talking about range() errors and calling an index that does not exist. I followed the following tutorial [this video] letter for letter and still got the error starting to feel like it is a problem from my python or something. My python version is 3.7 the code import cv2 import numpy as np import face_recognition import os import pickle path = 'known_faces' images = [] classNames = [] myList = os.listdir(path) print(myList) for cl in myList: curImg = cv2.imread(f'{path}/{cl}') images.append(curImg) classNames.append(os.path.splitext(cl)[0]) print(classNames) def findEncodings(images): encodeList
Cites Kenneth Arcasitas · 2023-03 · Stack Overflow · on “cv2.error (error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor')”
Why can't I convert my images? path = 'ImagesAttendance' known_images = [] classNames = [] myList = os.listdir(path) #print(myList) for cls in myList: curImg = cv2.imread(f"{path}/{cls}") known_images.append(curImg) classNames.append(os.path.splitext(cls)[0]) print(classNames) def find_encodings(images): encode_list = [] for img in images: #img = face_recognition.load_image_file(images) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) encode = face_recognition.face_encodings(img)[0] encode_list.append(encode) return encode_list encodeListKnown = find_encodings(known_images) The for loop is for looping through the images in my folder 'ImagesAttendance' and the function is for converting the list of