Skip to content

This is a face-detector app powered by C++, OpenCV and Multimedia Pipeline like GStreamer.

Notifications You must be signed in to change notification settings

adarsh-k27r/Face-Detector

Repository files navigation

Face Detection using OpenCV and GStreamer Pipeline (C++)

I primarily divided the whole task into two parts which are as follows:

Part 1:

  • Developed a GStreamer pipeline using the gst-launch command-line tool to read an MP4 video file.
  • Scaled down the input video to a 640x640 resolution.
  • Output JPEG-encoded frames from the scaled-down video.

Part 2:

  • Extended Part 1 by writing a C++ application to process the JPEG frames sequentially.
  • Utilized OpenCV’s haarcascade_frontalface_alt.xml classifier to detect and crop faces from each frame.
  • Organized the cropped faces into a frame-wise folder structure.

Key Technologies and Tools Used:

  • GStreamer: For creating the multimedia pipeline and processing the video file.
  • OpenCV: For image processing, including face detection and cropping using the haarcascade_frontalface_alt.xml classifier.
  • C++: For implementing the application to read, process, and organize JPEG frames.
  • Linux Ubuntu: Development environment.
  • Makefile: For compiling the C++ application.

Implementation Overview:

  1. GStreamer Pipeline Creation:

    • Constructed a pipeline to read the MP4 video, scaled it to 640x640 resolution, and encoded the frames as JPEG images.
    • Executed the pipeline using the gst-launch command line tool.
  1. Frame Processing Application:
    • Developed a C++ application to read the JPEG frames sequentially.
    • Utilized OpenCV’s haarcascade_frontalface_alt.xml classifier to detect faces in each frame.
    • Cropped detected faces and saved them in a structured folder hierarchy based on the frame number.
    • Created a Makefile to streamline the compilation and build process of the C++ application.

Results:

  • Successfully created a GStreamer pipeline to process and encode video frames.
  • Developed a robust C++ application that effectively reads JPEG frames from an MP4 video, detects and crops faces using OpenCV, and organizes them into a clear and manageable directory structure.
  • Ensured a seamless development process using Linux Ubuntu and a well-defined Makefile for efficient compilation.