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

@realeyes/preview-internal-face-detection-sdk

v1.0.28

Published

This program is for face duplication detection.

Downloads

35

Readme

preview-internal-face-detection-sdk

Description

This program is for face duplication detection.

This program can display camera content in video element and draw ellipse where face should be placed. If face checking is started and the face positioned inside of ellipse, then a picture of the face will be checked for face uniqueness and color of the ellipse represents the result.

Meaning of color of ellipse:

  • gray: face checking has not been started yet
  • yellow: face checking is running
  • green: no face duplication found
  • green: face duplication found

Feature list:

  • face detection,
  • change camera
  • take picture of video

npm

repository

Install

npm i @realeyes/preview-internal-face-detection-sdk

Getting started

  1. Copy models from npm package to public folder
cp -r  node_modules/@realeyes/preview-internal-face-detection-sdk/lib/models/  public/models/
  1. Create instance of Video class
  2. Attach video element by calling attachVideo method
  3. Call checkFace method

React

import { useEffect, useRef, useState } from "react";
import "./App.css";
import { Video } from "@realeyes/preview-internal-face-detection-sdk";
const ExternalId = "*";
const CollectionIds = ["*"];
function App() {
  const videoRef = useRef(null);
  const canvasPictureRef = useRef(null);

  const [video] = useState(
    new Video(
      "https://{stage}collect.realeyesit.com",
      process.env.REACT_APP_ACCESS_KEY!
    )
  );

  useEffect(() => {
    if (videoRef && videoRef.current) {
      video.attachVideo(videoRef.current);
      video.start();
    }
  }, [videoRef,videoRef.current]);

  const onTakePicture = () => {
    const pic = video.takePicture(canvasPictureRef.current); // if provide canvas the picture will be displayed inside canvas
  };

  const onChangeCamera = async () => {
    await video.changeCamera();
  };

  const onDetectFace = async () => {
    const result = await video.checkFace(ExternalId, CollectionIds);
  };

  return (
    <div className="App">
      <video
        id="vid"
        className="video-circle"
        ref={videoRef}
        width={320}
        autoPlay
        height={240}
      ></video>
      <canvas ref={canvasPictureRef} width={155} height={240}></canvas>
      <div>
        <button onClick={onChangeCamera}>Change camera</button>
        <button id="startbutton" onClick={onTakePicture}>
          Take photo
        </button>
        <button onClick={onDetectFace}>Detect face</button>
      </div>
    </div>
  );
}

export default App;


Vue

<script setup lang="ts">

import { Video } from "@realeyes/preview-internal-face-detection-sdk"
import { onMounted, ref } from "vue";

const ExternalId = "*";
const CollectionIds = ["*"];

const video = new Video("*")
const videoRef = ref<HTMLVideoElement | undefined>(undefined)
const canvasPictureRef = ref<HTMLCanvasElement | undefined>(undefined)

onMounted(() => {
  if (!videoRef.value) {
    throw new Error("videoRef.value null")
  }
  video.attachVideo(videoRef.value);
  video.start();
})

const onChangeCamera = () => {
  video.changeCamera()
}
const onTakePicture = () => {
  video.takePicture(canvasPictureRef.value)
}
const onDetectFace = () => {
  video.checkFace(ExternalId, CollectionIds)
}
</script>

<template>
  <video className="video-circle" ref="videoRef" width="320" height="240"></video>
  <canvas ref="canvasPictureRef" width=155 height=240></canvas>
  <div>
    <button @click="onChangeCamera">Change camera</button>
    <button @click="onTakePicture">
      Take photo
    </button>
    <button @click="onDetectFace">Detect face</button>
  </div>
</template>