FACE RECOGNISATION_IMAGE
 PROBLEM STATEMENT:
     Face recognition is a crucial application of computer vision that
     allows identifying and verifying individuals in an image. The
     goal of this project is to develop a system that can detect faces
     in an image using OpenCV.
 INTRODUCTION
     Face recognition technology has gained immense popularity in
     security, authentication, and automation. OpenCV, a powerful
     open-source library, provides pre-trained models to detect faces
     accurately. This project aims to implement face detection using
     OpenCV in Python within Visual Studio.
 DEVELOPMENT:
     This project is developed using Python and OpenCV's Haar
     Cascade Classifier, a pre-trained model for object detection. It
     reads an image, converts it to grayscale, detects faces, and
     highlights them using rectangles.
 FEATURES:
1.   Detects faces in an image using OpenCV.
2.   Uses Haar Cascade Classifier for accurate detection.
3.   Highlights detected faces with bounding boxes.
4.   Provides error handling for incorrect file paths.
5.   Works efficiently with various image formats.
 IMPLEMENTATION STEPS:
                         FACE RECOGNISATION_IMAGE
 1.   Install OpenCV using pip install opencv-python.
 2.   Load the pre-trained face detection model.
 3.   Provide the path to the image.
 4.   Convert the image to grayscale for better accuracy.
 5.   Detect faces using detectMultiScale().
 6.   Draw rectangles around detected faces.
 7.   Display the output image.
 8.   Handle cases where no faces are detected.
  LINK TO DOWNLOAD…."haarcascade_frontalface_default.xml":
  🔗 Download haarcascade_frontalface_default.xml
  SOURCE CODE:
import cv2
# Load the pre-trained face detection model
face_data =
cv2.CascadeClassifier(cv2.data.haarcascades +
"haarcascade_frontalface_default.xml")
# Read the image (Ensure the correct path)
image_path = r"C:\Users\ramas\Downloads\
download.png" # copy the path of the image and
must and should save that image with extension
.png to find path of the image open foldeer-
>select image->rightclick->select copy as path
# just type image_path =r (remaing just paste
the address if a image is already saved in png
no need to add any extension)
                FACE RECOGNISATION_IMAGE
img = cv2.imread(image_path)
# Check if the image is loaded successfully
if img is None:
    print(f"❌ Error: Unable to load image at
{image_path}. Check the file path and ensure
the file exists.")
    exit()
# Convert image to grayscale
grayscaled_img = cv2.cvtColor(img,
cv2.COLOR_BGR2GRAY)
# Detect faces in the image
face_coordinates =
face_data.detectMultiScale(grayscaled_img)
# Ensure at least one face is detected before
drawing
if len(face_coordinates) > 0:
    for (x, y, w, h) in face_coordinates:
        cv2.rectangle(img, (x, y), (x + w, y +
h), (0, 255, 0), 3)
    # Show the image with detected faces
    cv2.imshow('Face Recognition Image', img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
else:
    print("⚠️ No faces detected.")
 
                       FACE RECOGNISATION_IMAGE
   LIVE DEMONSTRATION:
   CONCLUSION:
    Face recognition using OpenCV is a robust and efficient
    approach to detecting faces in images. This project successfully
    demonstrates how Haar Cascade Classifier can be leveraged for
    face detection. The system effectively identifies faces and marks
    them with bounding boxes, making it a useful application in
    security, surveillance, and user authentication. Future
    improvements can include real-time face tracking and deep
    learning-based recognition for enhanced accuracy.