GithubHelp home page GithubHelp logo

deepencoding / face-clipper Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 51.26 MB

Read the mp4 video file and write JPEG encoded frames. Read each JPEG frame one by one and detecting faces from the image and crop it.

Shell 4.72% CMake 11.53% C++ 83.75%
cmake cpp gstreamer-pipeline opencv shell-script

face-clipper's Introduction

1. A simple gstreamer pipeline and run using gst-launch command line tool to read the mp4 video file, scale down the input to 640x640 resolution and write JPEG encoded frames.

1:

  1. cd into 1_stream_to_frames directory.

  2. Run the shell script and pass two command line arguments:
    argv[1]: Path to the mp4 file (I used ./sample_video/sample_1.mp4)
    argv[2]: Name of the output folder (I used out_1 for sample_1.mp4 and out_1_2 for sample_3.mp4)

    So it looks something like this:
    $ ./stream_to_frames.sh ./sample_video/sample_1.mp4 out_1

    The output will be in the same directory with the name you gave when running the command.

2: A C++ application to read each JPEG frame one by one. Uses OpenCV’s pre-trained XML classifier for detecting faces from the image and crop it. Creates a frame wise folder structure of cropped faces.

2:

  1. cd into 2_CaptureFaces directory.

  2. Run the command: $ cmake . To build the VS Solution.

    note: If you want to change the directory from which the C++ application takes input of the frames from, let's say you want to change the folder from 1_stream_to_frames/out_1_2 to 1_stream_to_frames/out_1"":

    1. Open CMakeLists.txt in a file editor.

    2. Locate the set_target_properties(CaptureFaces PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "../1_stream_to_frames/out_1_2/") command and change the command line argument:
      set_target_properties(CaptureFaces PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "//Enter changed directory here.//")

      Let's say if you want to take input from out_1 in the 1_stream_to_frames directory, then it will look something like this: set_target_properties(CaptureFaces PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "../1_stream_to_frames/out_1/")

      save and exit and start from step 1.

  3. Open the 'CaptureFaces.sln' file in Visual Studio and there you have the C++ Application project.

face-clipper's People

Contributors

deepencoding avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.