1.0.10 • Published 8 months ago

opencv-autocrop-photo-id v1.0.10

Weekly downloads
-
License
GNU
Repository
github
Last release
8 months ago

OpenCV AutoCrop Photo ID (Node.js)

npm

This package automatically detects faces in a picture and crops them for use as Photo ID. This is based on the opencv-facecrop by arghyadeep.

Installation

Install from command line:

npm install --save opencv-autocrop-photo-id

Basic Usage

const facecrop = require('opencv-autocrop-photo-id');

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

/* 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

Example 1 Example 2

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) Percentage by which the area of cropping of the face should be increased to add more details.

Defaults

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

License

OpenCV Autocrop Photo ID is published under the Public GNU license. For more information, see the accompanying LICENSE file.


1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.5

10 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago