Skip to main content

A basic library to crop largest face from the images.

Project description

mukham

Mukham (ముఖం; mook-hum) means face in Telugu! mukham is a simple library to detect the largest face in a given image. The face detection is performed using the DNN algorithm provided by opencv-python. The largest face is the box with largest enclosing area from the bounds of candidate faces detected.

Requirements

This package was written and tested in python 3.7+. This package requires the following dependencies:

    numpy>=1.18.1
    opencv-python>=4.1.2.30

Installation

The package can be installed as follows:

    pip install mukham

Usage

The package can be used through one of the following ways.

Command-line interface

    python -m mukham -i/--input path/to/input_image -o/--ouput path/to/output_largest_face -c/--conf confidence_threshold

This will print the top left and bottom right corner of the bounding box for the largest face. The (i)nput argument is required. The (o)utput path is optional, if given will save the largest face image to this path. The (c)onf is optional, otherwise must be a floating point number between 0 and 1 with default value of 0.8.

Code

    from mukham.detector import detect_largest_face

    bounding_box = detect_largest_face(path_to_input_img, out_path=path_to_output_img, min_conf=confidence_threshold)

The in_path is a required argument for path to the input image. The out_path is an optional keyword argument default to None, if given will save the largest face image to this path. min_conf is also a keyword argument with default set to 0.8. detect_largest_face will return a 2x2 array of the top left and bottom right corner of the bounding box for the largest face.

Tests

Unit tests have also been written which can be run as follows:

    cd path/to/mukham_package
    python -m unittest tests/test.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mukham-1.0.4.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

mukham-1.0.4-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file mukham-1.0.4.tar.gz.

File metadata

  • Download URL: mukham-1.0.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2

File hashes

Hashes for mukham-1.0.4.tar.gz
Algorithm Hash digest
SHA256 14b574c26beb3085866514bf625fcebc28b9c42c59f66e43c2847e54dc6fa30e
MD5 da0b016328f80edb82c6d8ca21c315ad
BLAKE2b-256 b53e6224657740ff3067cf42dd51b5bb4b3eff6d72f5d9c06222067d0a376425

See more details on using hashes here.

File details

Details for the file mukham-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: mukham-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2

File hashes

Hashes for mukham-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e8e54d0cc92bed0f1300321c5905a229d86de4930c518aa4e22b803875239e9e
MD5 68432eca60aa498b50808a386a0da67b
BLAKE2b-256 4c75260f0e2e0ab9b58eff044a986011c873fe857c1aff5c360e992c46603815

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page