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

@locusx/pose-detection

v1.0.6

Published

> 通过输入视频,可以执行动捕、面捕、手势识别、表情识别等功能,开启动捕时其余识别会基于动捕的数据进行识别

Downloads

4

Readme

@locusx/pose-detection

通过输入视频,可以执行动捕、面捕、手势识别、表情识别等功能,开启动捕时其余识别会基于动捕的数据进行识别

Install

安装:

npm install --save @locusx/pose-detection

复制静态资源:

将@locusx/pose-detection目录下的inferenceModel和ort拷贝到自己项目的静态目录下
parcel项目
inferenceModel和ort粘贴到dist目录下
vite项目
worker放到public目录下,inferenceModel和ort放到worker目录下

使用:

开启摄像头 openCamera(video) 用于开启摄像头,传入承载视频画面的video dom,返回是一个promise,结果是[width,height]视频画面的尺寸

import {openCamera} from "@locusx/pose-detection"

const video = document.getElementById("video")
openCamera(video)

开启3d场景 createThreeD(three) 用于创建初始的3D场景,传入div dom,返回的是3D场景的scene对象

import {createThreeD} from "@locusx/pose-detection"

const three = document.getElementById("three")
let scene = createThreeD(three)

导入模型 loadModel(url,scene) 用于像3D场景内导入模型,传入模型的地址以及scene场景对象,返回的是promise,结果是模型对象

import {loadModel,createThreeD} from "@locusx/pose-detection"

let scene = createThreeD(three)
let modelPromise = loadModel('./3DModel/trump_T.glb',scene)

识别

import {Identify} from "@locusx/pose-detection"
let identify = new Identify()
Identify.completeIdentify(video,size,options)
identify.bodyStatus = true
identify.faceStatus = true
identify.handStatus = true
identify.emotionStatus = true        
<template>
    <div class="PoseDetection_wrap">
        <video autoplay ref="video"></video>
        <canvas ref="canvas1" style="border:1px solid #fff;background-color: #000;"></canvas>
        <canvas ref="canvas2" style="border:1px solid #fff;background-color: #000;"></canvas>
    </div>
</template>

<script setup>
import { ref,onMounted } from "vue"
import { Identify, createThreeD, loadModel, openCamera } from "@locusx/pose-detection"
const video = ref(null)
const canvas1 = ref(null)
const canvas2 = ref(null)
onMounted(()=>{
    openCamera(video.value).then(res=>{
        canvas1.value.width = 256/2
        canvas1.value.height = 256/2
        let ctx1 = canvas1.value.getContext('2d');
        canvas2.value.width = 256/2
        canvas2.value.height = 256/2
        let ctx2 = canvas2.value.getContext('2d');
        console.log(ctx1)
        let identify = new Identify()
        identify.completeIdentify(video.value, res, {
            bodyOptions: {
                cb: () => { },
                x: 0,
                y: 0,
                width: res[0],
                height: res[1],
                model: null,
                drawCtx: ctx1
            },
            faceOptions: {
                cb: () => { },
                x: 220,
                y: 100,
                width: 256,
                height: 256,
                model:null,
                drawCtx:ctx2
            },
            emotionOptions: {
                cb: (res, time, describe) => {
                    // console.log(describe)
                },
                x: 220,
                y: 100,
                width: 256,
                height: 256,
            },
            handOptions: {
                cb: (res, time, describe) => { 
                    // console.log(describe)
                },
                x: [0, 416],
                y: [0, 0],
                width: [224, 224],
                height: [224, 224]
            }
        })

        identify.bodyStatus = true
        identify.faceStatus = true
        identify.handStatus = true
        identify.emotionStatus = true        
    })
})
</script>

<style scoped lang="scss">
.PoseDetection_wrap{
    position: absolute;
	bottom: 20px;
	right: 20px;
    border:1px solid #ccc;
    background: red;
}
</style>