P5js and Tracking js

edited March 2017 in p5.js Library Questions

Hi there, I'd like to know if anyone integrated p5js with tracking js yet..I'm interested in face tracking and pixel manipulation. My main question is about how to share the webcam between the 2 libraries..so far, running 2 separate sketches (both using the same webcam) works in firefox but it's quite slow and I was wondering if there's any way to merge everything in one sketch or any other example that I might take a look at. Thanks

Tagged:

Answers

  • update: so I manged to translate my sketch as instance and it's working..I'm now calling it inside the onload(). after that I am testing the tracking js sample code but I get the error "canvas is null".

    This a bit of the code I have in the onload

    window.onload = function() {
        var myp5 = new p5(mySketch);
    
        var video = document.getElementById('video');
        var canvas = document.getElementById('canvas');
        var context = canvas.getContext('2d');
    

    the canvas and video ids are set properly with the following code as I can see them in the console

    p.canvas = p.createCanvas(640, 480);
            p.canvas.id("canvas");
            p.pixelDensity(1);
            p.video = p.createCapture(p.VIDEO);
            p.video.id("video");
    

    then I have no idea what might be wrong..help? :)

    thanks!

  • This is quite old and uses clmtrackr instead but I thought it might help: https://gist.github.com/lmccart/2273a047874939ad8ad1

Sign In or Register to comment.