Giter VIP home page Giter VIP logo

pigo-wasm-demos's Introduction

pigo-wasm-demos

Pigo Wasm demos

This repository is a collection of Webassembly demos showcasing a few examples of the Pigo face detection library running real time. This repo will be continuously updated.

Install

Notice: at least Go 1.13 is required in order to run the demos!

$ go install github.com/esimov/pigo-wasm-demos@latest

Run

You only need to type $make demo{no}. This will build the package and produce an executable WebAssembly file which can be served over an http server. A new tab will be opened automatically in the user's default browser.

Demos

Masquerade

$ make demo1

pigo_wasm_masquarade

Key bindings:

q - Show/hide the detected face rectangle
z - Show/hide pupils
w - Show/hide eye mask
s - Show/hide mouth mask
e - Select the next eye mask
d - Select the previous eye mask
r - Select the next mouth mask
f - Select the previous mouth mask
x - Show the detected face coordinates

Faceblur

$ make demo2

pigo_wasm_faceblur

Key bindings:

] - Increase the blur radius
[ - Decrease the blur radius
f - Show/hide the detected face rectangle
s - Show/hide pupils
b - Enable/disable face blur

Background blur (in Zoom style)

$ make demo3

pigo_wasm_background_blur

Key bindings:

] - Increase the blur radius
[ - Decrease the blur radius
f - Show/hide the detected face rectangle
s - Show/hide pupils

Face triangulator

$ make demo4

pigo_wasm_triangulate

Key bindings:

f - Show/hide the detected face rectangle
s - Show/hide pupils
= - Increase the number of triangles
- - Decrease the number of triangles
] - Increase the threshold
[ - Decrease the threshold
1 - Increase the stroke size
0 - Decrease the stroke size

Pixelate

$ make demo5

pigo_wasm_pixelate

Key bindings:

f - Show/hide the detected face rectangle
s - Show/hide pupils
= - Increase the number of colors
- - Decrease the number of colors
] - Increase the cells size
[ - Decrease the cells size

Triangulated facemask

$ make demo6

facemask

This demo is meant to be a proof of concept for an idea of generating personalized triangulated face masks. The rectangle at the top right corner of the screen will turn green when the head alignment is the most appropriate for making a screen capture and this is when the head is aligned perpendicular (+/- a predefined threshold) and close enough to the camera. This demo can be expanded way further.

Key bindings:

f - Show/hide detected face marker
s - Show/hide pupils
= - Increase the number of triangles
- - Decrease the number of triangles
] - Increase the threshold
[ - Decrease the threshold
1 - Increase the stroke size
0 - Decrease the stroke size

Author

License

Copyright © 2020 Endre Simo

This software is distributed under the MIT license. See the LICENSE file for the full license text.

pigo-wasm-demos's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pigo-wasm-demos's Issues

access to localhost was denied

What did I do?

run the following commands:

$ go install github.com/esimov/pigo-wasm-demos@latest
package github.com/esimov/pigo-wasm-demos: build constraints exclude all Go files in /Users/xxx/go/pkg/mod/github.com/esimov/[email protected]
$ git clone [email protected]:esimov/pigo-wasm-demos.git
......
$ cd pigo-wasm-demos
$ make demo1
cp -f "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./js/
GOOS=js GOARCH=wasm go generate
GOOS=js GOARCH=wasm go build -o lib.wasm "masquerade.go"
open 'http://localhost:5000'
go run server/init.go
2022/11/30 11:24:34 serving /Users/xxx/pigo-wasm-demos on localhost:5000

What happened?

image

What I expected to happen?

demo1 running correctly.

Environment

  • Device: MacBook Pro M1
  • OS: macOS Ventura, Version 13.0.1
  • Browser: Microsoft Edge, Version 107.0.1418.56 (Official build) (arm64)
  • Go Version: go1.19.3 darwin/arm64

Make: serve: Command not found

Run make demo1 and this error happened.

tom@solar:~/go/src/github.com/esimov/pigo-wasm-demos$ make demo1
cp -f "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./js/
GOOS=js GOARCH=wasm go generate
GOOS=js GOARCH=wasm go build -o lib.wasm "masquerade.go"
xdg-open 'http://localhost:5000'
serve
make: serve: Command not found
make: *** [Makefile:28: serve] Error 127

Faceblur

For Faceblur demo, you should add some lag to the filter if the face-detection fails to discover a face.

i.e. If no face is detected, for a short period of time, assume the location of the face is the same as before and still apply the filter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.