Tastenkunst / brfv4_javascript_examples

BRFv4 - HTML5/Javascript - examples project. Reference implementation for all other platform example packages.
463 stars 148 forks source link

video feed #42

Closed floatingworld3 closed 5 years ago

floatingworld3 commented 6 years ago

sorry i may have asked this question elsewhere but I lost the thread. How do I use brf to track a face in a video rather than a webcam?

ghost commented 6 years ago

The way I've done it is by grabbing the video's pixels and painting them onto a canvas. I then pass the canvas into the BRF manager for inference.

Here's some psuedocode:

const $video = document.querySelector('#video-to-infer-on')
const $canvas = document.querySelector('#canvas-to-draw-into')
const context = $canvas.getContext('2d')
// brf = whatever variable you store the brf object into
// brfManager = whatever variable you store the brf manager into

// Paint video into canvas...you could also paint another canvas into the canvas, for example, photorealistic unity games
context.drawImage($video, 0, 0, brf.resolution.width, brf.resolution.height)

// Get faces
brfManager.update(context.getImageData(0, 0, brf.resolution.width, brf.resolution.height).data)
const faces = brfManager.getFaces()
floatingworld3 commented 6 years ago

Thanks for the pseudo code...could you give a specific instance for "#canvas-to-draw-into" ? Is #video-to-infer-on' the path name to the video? Thanks again

vkasojhaa commented 5 years ago

@floatingworld3 did you get the face tracker working on video?

floatingworld3 commented 5 years ago

Hello vikas,

Sorry for the late reply. No I did not get tracker working on video. Do you have some sample code?

David

Sent from my iPhone

On 8 Apr 2019, at 7:36 pm, Vikas Ojha notifications@github.com wrote:

@floatingworld3 did you get the face tracker working on video?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.