Real-Time Face Recognition with Python and OpenCV - A Step-by-Step Guide 🚀

Поділитися
Вставка
  • Опубліковано 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

КОМЕНТАРІ • 55

  • @johnsk5
    @johnsk5 7 місяців тому +3

    Great work. Gonna help lots of people including me👏

  • @awadijohan
    @awadijohan Місяць тому

    great video thanks you saved my journey, appreciate help and thanks from bottom heart

  • @sahilgamer4081
    @sahilgamer4081 7 місяців тому +1

    Supb.. Bro..... ❤

  • @forwardtechnical
    @forwardtechnical 5 місяців тому

    Great video, can you make the same thing using CNN model please !!

  • @Junior-fq8jo
    @Junior-fq8jo 3 місяці тому +1

    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 UA-cam pour parvenir à le réparer mais sans succès en utilisant pip install opencv-python mais sans succès slt tu peux m'aider ?

  • @rifat4330
    @rifat4330 7 місяців тому +1

    Nice one bro❤
    .
    .
    .
    I need e face recognition tutorial with YOLO algorithm.

    • @apycoder
      @apycoder  7 місяців тому +1

      Ok yolo tutorial will come soon 🥰

  • @gungungupta162
    @gungungupta162 9 днів тому

    pura code likha but its showing error : no such file or directory

  • @nesrinkalkan2339
    @nesrinkalkan2339 7 днів тому +1

    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

    • @volodyslove
      @volodyslove 6 днів тому

      I just uninstalled numpy 2.x.x, and then installed older version 1.26.4 (pip install numpy==1.26.4)

  • @ManojKumar-go1pm
    @ManojKumar-go1pm 4 місяці тому

    Can you make vdo on ,how to connect template in django

  • @syaabanbux7516
    @syaabanbux7516 Місяць тому +1

    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

  • @Deadsoul098
    @Deadsoul098 5 місяців тому

    Assalamualaikum fase recingization ky liy konsi app use kr rhy ha ?ya ap kis pa work kr rhy ha plz tell me?

    • @apycoder
      @apycoder  4 місяці тому

      Linux OS and visual studio code for this project

  • @sithuaung2433
    @sithuaung2433 4 місяці тому

    Please can you explain and code for object detection with live webcam Sir?Please Sir?

    • @apycoder
      @apycoder  4 місяці тому

      Check my video there is specific for object detection, eye detection, blink counter, and driver drowsiness detection

  • @ojamyjack4248
    @ojamyjack4248 4 місяці тому +1

    how do i get the face_recognition module

    • @apycoder
      @apycoder  3 місяці тому

      pip install face_recognition
      pip install opencv-python
      If you don't have Python installed, download and install it from the official Python website:

  • @Aaa90099
    @Aaa90099 3 місяці тому

    Can I use raspberry pi through ssh and do this? If yes how?

    • @apycoder
      @apycoder  3 місяці тому

      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.

  • @awabibrahimmohamedahmed6464
    @awabibrahimmohamedahmed6464 3 місяці тому

    bro what is the type of the app that you are working at??

    • @apycoder
      @apycoder  3 місяці тому

      I am using Kali Linux OS , and visual studio code for development

    • @awabibrahimmohamedahmed6464
      @awabibrahimmohamedahmed6464 3 місяці тому

      the camera never shows up
      @@apycoder

    • @rishigujarathi7146
      @rishigujarathi7146 25 днів тому

      ​@@apycoder it can run on windows or not?

    • @apycoder
      @apycoder  25 днів тому

      Officially the face recognition library doesn't support windows. So it won't run

  • @user-bl7yh5if9s
    @user-bl7yh5if9s 4 місяці тому

    how to install face recognition for python 3.12?

    • @apycoder
      @apycoder  4 місяці тому

      Join our WhatsApp group

  • @user-of8pd5pl4z
    @user-of8pd5pl4z 4 місяці тому

    Identation problem at unknown

    • @apycoder
      @apycoder  4 місяці тому

      Join our WhatsApp group and send me your code

  • @_AYANROY
    @_AYANROY 6 місяців тому +2

    face recognition is not installing. can you help please ?

    • @kexanatoronto6896
      @kexanatoronto6896 6 місяців тому

      Send your error code

    • @annmariyajoy6293
      @annmariyajoy6293 5 місяців тому

      I also got the same error

    • @apycoder
      @apycoder  5 місяців тому

      Check face recognition library documentation. Is it compatible with your operating systems or not

    • @nikkiverse3070
      @nikkiverse3070 4 місяці тому

      @@apycoder
      IndentationError: unindent does not match any outer indentation level
      Help me

  • @amanisguru6114
    @amanisguru6114 4 місяці тому

    Isme attendance kaise laga sakte hai

    • @apycoder
      @apycoder  4 місяці тому

      There is a separate video for face recognition based attendance system

    • @amanisguru6114
      @amanisguru6114 4 місяці тому

      @@apycoder watched it already

  • @snehagupta4586
    @snehagupta4586 3 місяці тому

    Name error : name 'known_person1_image' is not defined
    How to resolve this???

    • @apycoder
      @apycoder  3 місяці тому

      If you are using window os then give the complete image path

    • @apycoder
      @apycoder  3 місяці тому

      Send me code on WhatsApp

    • @devjai643
      @devjai643 3 місяці тому

      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()

    • @devjai643
      @devjai643 3 місяці тому

      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()

    • @snehagupta4586
      @snehagupta4586 2 місяці тому

      I am getting name error in code how to correct this?

  • @tahmidrahman8173
    @tahmidrahman8173 7 місяців тому +1

    is it based on CNN?

    • @apycoder
      @apycoder  7 місяців тому

      Yes python face recognition library is based on CNN

    • @sujoysetua0814
      @sujoysetua0814 7 місяців тому

      ​​@@apycodervai please give the source code

    • @apycoder
      @apycoder  7 місяців тому

      Go and visit again to get Source code , i have added link in the description

  • @lavanreddy2408
    @lavanreddy2408 3 місяці тому

    Bro can you send source code

    • @apycoder
      @apycoder  3 місяці тому

      There is a source code link in the description

    • @devjai643
      @devjai643 3 місяці тому

      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()