{"id":24443786,"url":"https://github.com/arya-io/cpp-opencv","last_synced_at":"2026-05-05T11:31:38.375Z","repository":{"id":272974098,"uuid":"918308698","full_name":"arya-io/cpp-opencv","owner":"arya-io","description":"A pipeline for extracting video frames using GStreamer and detecting/cropping faces from the frames using OpenCV's Haar Cascade classifier in C++.","archived":false,"fork":false,"pushed_at":"2025-03-07T12:34:25.000Z","size":14915,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T13:35:16.996Z","etag":null,"topics":["computervision","cpp","facedetection","frameextraction","gstreamer","haarcascade","imageprocessing","opencv","shellscript","videoprocessing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arya-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T17:02:30.000Z","updated_at":"2025-03-07T12:34:29.000Z","dependencies_parsed_at":"2025-03-07T13:39:52.577Z","dependency_job_id":null,"html_url":"https://github.com/arya-io/cpp-opencv","commit_stats":null,"previous_names":["arya-io/cpp-opencv"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arya-io%2Fcpp-opencv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arya-io%2Fcpp-opencv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arya-io%2Fcpp-opencv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arya-io%2Fcpp-opencv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arya-io","download_url":"https://codeload.github.com/arya-io/cpp-opencv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243515564,"owners_count":20303258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computervision","cpp","facedetection","frameextraction","gstreamer","haarcascade","imageprocessing","opencv","shellscript","videoprocessing"],"created_at":"2025-01-20T22:17:35.807Z","updated_at":"2026-05-05T11:31:33.320Z","avatar_url":"https://github.com/arya-io.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Video Frame Extraction and Face Detection\n\nThis repository contains two parts:\n\n1. **GStreamer Pipeline** (Part 1) — A shell script that extracts and saves frames from a video using GStreamer.\n2. **Face Detection in C++** (Part 2) — A C++ program that detects and crops faces from the frames using OpenCV's Haar Cascade classifier.\n\n---\n\n## Prerequisites\n\nBefore running the code, make sure you have the following installed on your system:\n\n- **GStreamer** (for Part 1)\n- **OpenCV** (for Part 2)\n- **g++** or any other C++ compiler\n\n## Part 1: GStreamer Pipeline\n\nThis part uses GStreamer to extract frames from a video and save them as JPEG images.\n\n### Steps:\n\n**Run the provided shell script:**\n\n`./part1_pipeline.sh`\n\n**The script part1_pipeline.sh uses GStreamer’s gst-launch command to:**\n- Read the input MP4 video.\n- Scale the video frames to a resolution of 640x640 pixels.\n- Encode each frame as a JPEG image.\n\n**Example GStreamer pipeline used by the script:**\n`gst-launch-1.0 filesrc location=video.mp4 ! decodebin ! videoconvert ! videoscale ! video/x-raw,width=640,height=640 ! jpegenc ! multifilesink location=\"frame_%05d.jpg\"`\n\n### Output:\nThe frames will be saved as sequentially numbered JPEG files (e.g., frame_00001.jpg, frame_00002.jpg, etc.) in the `Part_1_Output/frames/` directory.\n\n## Part 2: Face Detection with OpenCV\nThis part is a C++ application that processes the JPEG frames from Part 1 and detects faces in them using OpenCV’s pre-trained Haar Cascade classifier. It then crops the detected faces and saves them in a structured output directory.\n\n### Steps:\n1. Using g++, compile the program manually.\nEnsure that `face_detection.cpp` includes the OpenCV headers, and the Haar Cascade XML file is available in the same directory or the proper path is set.\n\n2. Run the face detection program.\nAfter compiling the code, run the program:\n`./face_detection`\nThe program takes two arguments: the input directory (which contains the frames) and the output directory (where the cropped faces will be saved).\nThe application will loop through each frame, detect faces using OpenCV, crop the faces, and save them to the Part2_Output/ directory.\n\n### Output:\nEach frame’s detected faces will be saved in a corresponding subdirectory within Part_2_Output/ (e.g., Part_2_Output/frame_1/, Part_2_Output/frame_2/).\nIf multiple faces are detected in a frame, they will be saved as separate files (e.g., face_1.jpg, face_2.jpg).\n\n## Notes:\n- You can modify the shell script or C++ program to adjust the input/output paths or the parameters such as frame resolution or face detection sensitivity.\n- Ensure that the Haar Cascade XML file for face detection (e.g., haarcascade_frontalface_default.xml) is present in the correct location or specify the correct path in the C++ code.\n\n# License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farya-io%2Fcpp-opencv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farya-io%2Fcpp-opencv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farya-io%2Fcpp-opencv/lists"}