Giter Club home page Giter Club logo

opencv-facecrop's Introduction

OpenCv - Face Crop : Autodetect & crop faces out of an image (Node.js)

CI codecov.io Quality Gate Status npm npm bundle size Libraries.io SourceRank Depfu Snyk Vulnerabilities for npm package npm NPM

This package helps you to auto-detect faces in a picture and crop them out.

Installation

NPM

Install from command line:

npm install --save opencv-facecrop

Basic Usage

const facecrop = require('opencv-facecrop');

facecrop('./image-file.jpg', './dest/output.jpg', "image/jpeg", 0.95, 50);

/* 
Outputs image with file name output.jpg in 'dest' folder with the face cropped out.

If multiple faces are detected, the files will be automatically renamed to output-1.jpg, output-2.jpg and so on.
*/

Results

Original Image:



Cropped Image:

Image by Free-Photos from Pixabay

API

facecrop(input_filename, output_filename, type, quality, factor)

  • input_filename: Input String containing file name with relative/absolute filepath.

  • output_filename: (Optional) Requires a string value which will contains the output file name.

  • type: (Optional) Requires String value which will tell the format of the output image.

  • quality: (Optional) Requires a float value between 0 to 1 which stands for the quality index of the output file compares to the input file. Set 1 for no reduction in quality.

  • factor: (Optional) Factor by which the area of cropping of the face should be increased to add more details. Use -ve value to decrease.

Defaults

  • input_filename: Mandatory parameter
  • output_filename: "./output.jpg"
  • type: 'image/jpeg'
  • quality: 0.95
  • factor: 1

Changelogs:

To view the changelogs, please refer to the Github Releases page of this project.

License

OpenCv - Face Crop is published under the Unlicense. For more information, see the accompanying LICENSE file.




P.S. - This is a pre-release version. More updates with refinements coming soon.

opencv-facecrop's People

Contributors

arghyadeep-k avatar mshd 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.