Created
May 18, 2018 19:55
-
-
Save neopunisher/804e44a2035c92782e18bc145d4c90cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(url1, url2, url3, inj) { | |
inj(url1).then(() => inj(url2)).then(() => inj(url3)).then(async function() { | |
var canvas = document.createElement('canvas') | |
var ctx = canvas.getContext('2d'); | |
const net = await posenet.load(); | |
var processfn = async function(video, dt) { | |
ctx.drawImage(video, 0, 0); | |
const imageScaleFactor = 0.50; | |
const flipHorizontal = false; | |
const outputStride = 16; | |
// load the posenet model | |
const pose = await net.estimateSinglePose(canvas, imageScaleFactor, flipHorizontal, outputStride); | |
console.log('pose:', pose) | |
} | |
document.body.appendChild(canvas) | |
var button = document.createElement('button') | |
button.innerText = 'go' | |
button.onclick = function button_callback() { | |
var mycamvas = new camvas(ctx, processfn); | |
} | |
document.body.appendChild(button) | |
}) | |
})('https://cdn.rawgit.com/tehnokv/picojs/0ed6595c/cam/camvas.js', 'https://unpkg.com/@tensorflow/tfjs', 'https://unpkg.com/@tensorflow-models/posenet', (src) => new Promise(function(c, d) { | |
var a = document.createElement("script"); | |
a.src = src; | |
a.type = "text/javascript"; | |
a.onload = c; | |
a.onerror = d; | |
document.head.appendChild(a) | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment