Real-Time Face Recognition with Python and OpenCV - A Step-by-Step Guide 🚀
HTML-код
- Опубликовано: 7 ноя 2023
- 👋 Hello, tech enthusiasts! Welcome back to the ApyCoder channel, where we're about to embark on an incredible journey into the world of Face Recognition using Python and OpenCV. 🌟
Imagine a world where your computer knows you by face! In this mind-blowing tutorial, we'll guide you through the art of real-time face recognition, a technology with limitless possibilities.
🌟Buy Source Code
apycoder.com/product/real-tim...
Buy me Coffee ☕: ko-fi.com/apycoder
Support Us
apycoder.com/support-us/
Read Complete Blog For this
apycoder.com/how-to-build-rea...
Blogs
apycoder.com/category/blog/
🔥 Here's what you'll discover:
🔹 Easy installation of essential libraries (OpenCV and face_recognition).
🔹 Encoding and loading known faces for seamless recognition.
🔹 Initiating your webcam for instant, real-time face identification.
🔹 Capturing live video frames, detecting faces, and labeling them on the fly.
🔹 Witnessing the magic as the code recognizes faces right before your eyes.
Whether you're a coding beginner or a seasoned developer, our step-by-step instructions ensure you grasp the concept effortlessly. By the end of this video, you'll be equipped to create your own face recognition system. 💻
🙋♀️🙋♂️ Have questions or ideas? Share them in the comments below - we love hearing from you. And remember to subscribe and enable notifications, so you never miss an update from us.
Ready to unlock the future with face recognition? Let's dive in and make technology work for us! 🚀💡
#Python
#OpenCV
#FaceRecognition
#ComputerVision
#MachineLearning
#ArtificialIntelligence
#PythonProgramming
#ImageProcessing
#FacialRecognition
#DeepLearning
#Tutorial
#CodeExamples
#ComputerVisionTutorial
#PythonOpenCV
#FacialDetection
#FacialAnalysis
#ObjectDetection
#DLib
#OpenCVTutorial
#ImageRecognition
#Programming
#PythonDevelopment
#FaceDetection
#FacialRecognitionSoftware
#FacialRecognitionSystem
Great work. Gonna help lots of people including me👏
great video thanks you saved my journey, appreciate help and thanks from bottom heart
Supb.. Bro..... ❤
Great video, can you make the same thing using CNN model please !!
Salut et super travaille j'essai de faire le même depuis mais un message d'erreur s'affiche disant module cv2 not found donc j'ai passé des heures sur RUclips pour parvenir à le réparer mais sans succès en utilisant pip install opencv-python mais sans succès slt tu peux m'aider ?
Nice one bro❤
.
.
.
I need e face recognition tutorial with YOLO algorithm.
Ok yolo tutorial will come soon 🥰
pura code likha but its showing error : no such file or directory
Exception has occurred: RuntimeError
Unsupported image type, must be 8bit gray or RGB image.
File "C:\Users\ASUS\Desktop\bitirme\.ipynb_checkpoints\import face_recognition.py", line 13, in
face_encodings = face_recognition.face_encodings(rgb_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Unsupported image type, must be 8bit gray or RGB image.
bu hatayı alıyorum lütfen yardımcı olurmusunuz
I just uninstalled numpy 2.x.x, and then installed older version 1.26.4 (pip install numpy==1.26.4)
Can you make vdo on ,how to connect template in django
Sure
Yo bro, i have a favor to ask, how can i use face recorgnition to recognize face image that were stored in the database. If the face image is same as the image that were captured by the frame then it will display my name, can u show me how to do that, sorry if my english is bad
did u figure it out how?
Assalamualaikum fase recingization ky liy konsi app use kr rhy ha ?ya ap kis pa work kr rhy ha plz tell me?
Linux OS and visual studio code for this project
Please can you explain and code for object detection with live webcam Sir?Please Sir?
Check my video there is specific for object detection, eye detection, blink counter, and driver drowsiness detection
how do i get the face_recognition module
pip install face_recognition
pip install opencv-python
If you don't have Python installed, download and install it from the official Python website:
Can I use raspberry pi through ssh and do this? If yes how?
Yes, you can use a Raspberry Pi for a face recognition project via SSH. You'll need to set up the necessary software and libraries on your Raspberry Pi, and then you can access and control it remotely using SSH. Make sure your Raspberry Pi has a camera module or a compatible USB camera for capturing images for face recognition.
bro what is the type of the app that you are working at??
I am using Kali Linux OS , and visual studio code for development
the camera never shows up
@@apycoder
@@apycoder it can run on windows or not?
Officially the face recognition library doesn't support windows. So it won't run
how to install face recognition for python 3.12?
Join our WhatsApp group
Identation problem at unknown
Join our WhatsApp group and send me your code
face recognition is not installing. can you help please ?
Send your error code
I also got the same error
Check face recognition library documentation. Is it compatible with your operating systems or not
@@apycoder
IndentationError: unindent does not match any outer indentation level
Help me
Isme attendance kaise laga sakte hai
There is a separate video for face recognition based attendance system
@@apycoder watched it already
Name error : name 'known_person1_image' is not defined
How to resolve this???
If you are using window os then give the complete image path
Send me code on WhatsApp
Re-check the name there must be a typo in your code,
Here is the working code:
import cv2
import face_recognition
# Load known face encodings & names
known_face_encodings = []
known_face_names = []
# Load known faces & their names
known_person1_image = face_recognition.load_image_file("Photos/Dev.jpg")
known_person2_image = face_recognition.load_image_file("Photos/Elon.jpg")
known_person1_encoding = face_recognition.known_face_encodings(known_person1_image)[0]
known_person2_encoding = face_recognition.known_face_encodings(known_person2_image)[0]
known_face_encodings.append(known_person1_encoding)
known_face_encodings.append(known_person2_encoding)
known_face_name.append("Dev")
known_face_name.append("Elon")
# Initialize the webcam
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame by frame
ret, frame = video_capture.read()
# Find all face location in the current frame
face_locations = face_recognition.face_location(frame)
face_encodings = face_recognition.face_encoding(frame, face_location)
# Loop through each frame found in the frame
for (top, right, bottom, left), face_encoding in zip(face_location, face_encodings):
# Check if face matches any known faces
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
name = "Unknown"
if True in matches:
first_match_index = matches.index(True)
name = known_face_names[first_match_index]
#Draw a box around the box & label the face_encoding
cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)
cv2.putText(frame, name, (left, top - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 255), 2)
# Display the resulting frame
cv2.imshow("Video", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release the webcam and close OpenCV
video_capture.release()
cv2.destroyAllWindows()
Try this:
import cv2
import face_recognition
# Load known face encodings & names
known_face_encodings = []
known_face_names = []
# Load known faces & their names
known_person1_image = face_recognition.load_image_file("Photos/Dev.jpg")
known_person2_image = face_recognition.load_image_file("Photos/Elon.jpg")
known_person1_encoding = face_recognition.face_encodings(known_person1_image)[0]
known_person2_encoding = face_recognition.face_encodings(known_person2_image)[0]
known_face_encodings.append(known_person1_encoding)
known_face_encodings.append(known_person2_encoding)
known_face_names.append("Dev")
known_face_names.append("Elon")
# Initialize the webcam
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame by frame
ret, frame = video_capture.read()
# Find all face location in the current frame
face_locations = face_recognition.face_locations(frame)
face_encodings = face_recognition.face_encodings(frame, face_locations)
# Loop through each frame found in the frame
for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
# Check if face matches any known faces
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
name = "Unknown"
if True in matches:
first_match_index = matches.index(True)
name = known_face_names[first_match_index]
#Draw a box around the box & label the face_encoding
cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)
cv2.putText(frame, name, (left, top - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 255), 2)
# Display the resulting frame
cv2.imshow("Video", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release the webcam and close OpenCV
video_capture.release()
cv2.destroyAllWindows()
I am getting name error in code how to correct this?
is it based on CNN?
Yes python face recognition library is based on CNN
@@apycodervai please give the source code
Go and visit again to get Source code , i have added link in the description
Bro can you send source code
There is a source code link in the description
import cv2
import face_recognition
# Load known face encodings & names
known_face_encodings = []
known_face_names = []
# Load known faces & their names
known_person1_image = face_recognition.load_image_file("Photos/Dev.jpg")
known_person2_image = face_recognition.load_image_file("Photos/Elon.jpg")
known_person1_encoding = face_recognition.face_encodings(known_person1_image)[0]
known_person2_encoding = face_recognition.face_encodings(known_person2_image)[0]
known_face_encodings.append(known_person1_encoding)
known_face_encodings.append(known_person2_encoding)
known_face_names.append("Dev")
known_face_names.append("Elon")
# Initialize the webcam
video_capture = cv2.VideoCapture(0)
while True:
# Capture frame by frame
ret, frame = video_capture.read()
# Find all face location in the current frame
face_locations = face_recognition.face_locations(frame)
face_encodings = face_recognition.face_encodings(frame, face_locations)
# Loop through each frame found in the frame
for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings):
# Check if face matches any known faces
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
name = "Unknown"
if True in matches:
first_match_index = matches.index(True)
name = known_face_names[first_match_index]
#Draw a box around the box & label the face_encoding
cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)
cv2.putText(frame, name, (left, top - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 255), 2)
# Display the resulting frame
cv2.imshow("Video", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release the webcam and close OpenCV
video_capture.release()
cv2.destroyAllWindows()