npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@biopassid/face-sdk

v1.3.26

Published

<h1 align="center"> <br> <a href="http://www.biopassid.com"><img src="https://uploads-ssl.webflow.com/5ec3d6d0293839cf102a656a/63a0d4cec83bbddea006d27a_biopassamarelo.svg" alt="BioPass ID" width="200"></a> <br>

Downloads

844

Readme

Key Features

  • Face Detection
    • We ensure that there will be only one face in the capture
  • Face Positioning
    • Ensure face position in your capture for better enroll and match.
  • Auto Capture
    • When a face is detected the capture will be performed in how many seconds you configure.
  • Resolution Control
    • Configure the image size thinking about the tradeoff between image quality and API's response time.
  • Aspect Ratio Control
  • Fully customizable interface

Customizations

Increase the security of your applications without harming your user experience.

All customization available:

  • Title Text
  • Help Text
  • Loading Text
  • Font Family
  • Face Frame
  • Overlay
  • Default Camera
  • Capture button

Enable or disable components:

  • Tittle text
  • Help Text
  • Capture button
  • Button icons
  • Flip Camera button
  • Flash button

Change all colors:

  • Overlay color and opacity
  • Capture button color
  • Capture button text color
  • Flip Camera color
  • Flash Button color
  • Text colors

Demo

Explore our features that make your apps do more.

Web Demo - of BioPass ID Face SDK JavaScript and API'S

First Steps

First create a folder called models in your application's static files directory. Donwload and add this two files

tiny_face_detector_model-shard1

tiny_face_detector_model-weights_manifest

Your folder structure will look like this:

/assets
/js
/css
/models
    - tiny_face_detector_model-shard1
    - tiny_face_detector_model-weights_manifest.json
/index.html

Installing

Through bundler

Install the dependency:

npm i --save @biopassid/face-sdk

Use in your project:

import { camera } from '@biopassid/face-sdk'

Through CDN

Add the script to the project and the modules will be injected inside an object called faceSdk:

<script src="https://cdn.jsdelivr.net/npm/@biopassid/face-sdk/face-sdk.min.js"></script>
<script>
        const {takePicture} = faceSdk.camera();
        async function handleTakePicture() {
            const resp = await takePicture({
                element: document.querySelector("#elementId"),
            })
        }
        handleTakePicture();


</script>

How To Use

Basic usage

import { camera } from '@biopassid/face-sdk'
<script>
        const {takePicture} = camera();
        async function handleTakePicture() {
            const resp = await takePicture({
                element: document.querySelector("#elementId"),
            })
        }
        handleTakePicture();
</script>

Adding Face Validation

The takePicture function has an argument called "faceDetectionAdapter", which is a function responsible for performing the validation processing, the FaceSDK has a standard adapter for face detection. It is also necessary to run the function responsible for loading the models

import { camera, faceDetectionAdapter, loadFaceDetectorModels } from '@biopassid/face-sdk'

const { takePicture } = camera();

async function handleTakePicture() {
    await loadFaceDetectorModels(); // Carregamento dos modelos

    const resp = await takePicture({
        element: document.querySelector("#elementId"),
        faceDetectionAdapter: faceDetectionAdapter,
    })
}

Adding Auto Capture

To add automatic capture, simply activate the functionality within the options parameter.

import { camera, faceDetectionAdapter, loadFaceDetectorModels } from '@biopassid/face-sdk'

const { takePicture } = camera();

async function handleTakePicture() {
    await loadFaceDetectorModels();

    const resp = await takePicture({
        element: document.querySelector("#elementId"),
        faceDetectionAdapter: faceDetectionAdapter,
        options: {
            faceDetection: {
                autoCapture: true
            }
        },
    })
}

Internationalization

It is possible to define the texts displayed during face detection through parameter i18n.

import { camera, faceDetectionAdapter } from '@biopassid/face-sdk'

const { takePicture } = camera();

async function handleTakePicture() {
    const resp = await takePicture({
        element: document.querySelector("#elementId"),
        faceDetectionAdapter: faceDetectionAdapter,
        i18n: {
            noFacesDetected: "Nenhuma face detectada",
            multipleFacesDetected: "Multiplas faces detectadas",
            moveFaceLeft: "Mova o rosto para a esquerda",
            moveFaceRight: "Mova o rosto para a direita",
            moveFaceUp: "Mova o rosto para cima",
            moveFaceDown: "Mova o rosto para baixo",
            keepStill: "Mantenha o rosto parado",
        },
        options: {
            faceDetection: {
                autoCapture: true
            }
        },
    })
}

Example

Example with all properties

All elements are optional

const resp = await takePicture({
    element: document.querySelector("#camera"),
    options: {
        mask: {
            enabled: true,
            type: 'face',
            backgroundColor: 'black',
            backgroundOpacity: .6,
            frameColor: 'white',
            frameThickness: 3,
        },
        backButton: {
            enabled: true,
            size: '30px',
            backgroundColor: 'transparent',
            label: {
                enabled: false,
                content: "",
                fontSize: '1rem',
                fontWeight: 'normal',
                color: 'white',
            },
            icon: {
                enabled: true,
                source: null,
                color: 'white',
                size: '30px',
            },
            padding: "0",
        },
        captureButton: {
            enabled: true,
            size: '30px',
            backgroundColor: 'white',
            label: {
                enabled: false,
                content: "",
                fontSize: '1rem',
                fontWeight: 'normal',
                color: 'black',
            },
            icon: {
                enabled: true,
                source: null,
                color: 'black',
                size: '30px',
            },
            padding: string,
        },
        cancelButton: {
            enabled: true,
            size: '30px',
            backgroundColor: 'red',
            label: {
                enabled: false,
                content: "",
                fontSize: '1rem',
                fontWeight: 'normal',
                color: 'white',
            },
            icon: {
                enabled: true,
                source: null,
                color: 'white',
                size: '30px',
            },
            padding: "0",
        },
        confirmButton: {
            enabled: true,
            size: '30px',
            backgroundColor: 'white',
            label: {
                enabled: false,
                content: "",
                fontSize: '1rem',
                fontWeight: 'normal',
                color: 'black',
            },
            icon: {
                enabled: true,
                source: null,
                color: 'black',
                size: '30px',
            },
            padding: string,
        },
        legend: {
            title: {
                enabled: true,
                content: "Captura Facial",
                fontSize: '1.5rem',
                fontWeight: '600',
                color: 'white',
            },
            subtitle: {
                enabled: true,
                content: "",
                fontSize: '1rem',
                fontWeight: 'normal',
                color: 'white',
            }
        },
        faceDetection: {
            enabled: true,
            autoCapture: false,
            timeToCapture: 3000,
            timeToCaptureFeedbackColor: "#FF0000",
            multipleFacesEnabled: true,
            scoreThreshold: 0.1
        },
        width: '100%',
        height: '100%',
        modelsDirectory: '/models',
        cameraPresets: {
            aspectRatio: 16/9,
            preferredResolution: 480,
            deviceId: null,
            facingMode: "environment",
            maxCameraCapacity: true
        },
        fontFamily: 'inherit',
        formatImage: 'image/jpeg'
    }
})

Options

To know more about all SDK options and methods you can visit our complete documentation

Documentation

Changelog

1.3.26

Breaking Changes

  • When using the plugin via CDN, the functions are stored in an object named faceSdk.
<!-- After -->
<script src="https://cdn.jsdelivr.net/npm/@biopassid/face-sdk/face-sdk.min.js"></script>
<script>
    const { takePicture } = faceSdk.camera();
</script>

<!-- Before -->
<script src="https://cdn.jsdelivr.net/npm/@biopassid/face-sdk/face-sdk.min.js"></script>
<script>
    const { takePicture } = camera();
</script>