Socket
Socket
Sign inDemoInstall

opencv-facecrop

Package Overview
Dependencies
116
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    opencv-facecrop

Npm package to autodetect and crop faces using opencv


Version published
Weekly downloads
3
increased by50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

CI codecov.io 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) Pixels 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: 0

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.

Keywords

FAQs

Last updated on 27 Sep 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc