OpenCv - Face Crop : Autodetect & crop faces out of an image (Node.js)
This package helps you to auto-detect faces in a picture and crop them out.
Installation
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);
Results
Original Image:
Cropped Image:
Image by Free-Photos from Pixabay
API
facecrop(input_filename, output_filename, type, quality)
-
input_filename: Input String containing file name with relative/absolute filepath.
-
output_filename: Requires a string value which will contains the output file name.
-
type: Requires String value which will tell the format of the output image.
-
quality: 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.
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.