You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.
when copying pixels from the video to my canvas, it looks like I am copying pixels from the video at the original size, not scaled down at 320x240. Maybe a Bug? Me running latest p5.js complete - March 4 2016 release on Mac OSX 10.11.3
But not just the scale is wrong, please see the image attached.
Now, since I remeber I sow something similar in processing, I found Daniel's code of the learning processing exercises ported in p5js, give them a try and they worked perfectly, so I decided to go line by line and see what was wrong with my code.
After 1 hour of complete frustration, I decided to change the only thing left: the libraries folder itself.
And It worked! As soon as I overwrite the DOM library with the older libraries, from the learning processing exercise, all problems are fixed.
Now, this is driving me crazy. What's going on? Is there a bug on the latest libraries of p5js?
following my code that replicates the one of the tutorial.
varvideo;functionsetup(){createCanvas(320,240);// if you work on Hi-density display you need to add the following linepixelDensity(1);video=createCapture(VIDEO);video.size(320,240);}functiondraw(){background(51);video.loadPixels();loadPixels();for(vary=0;y<height;y++){for(varx=0;x<width;x++){varindexLoc=(x+y*width)*4;varr=video.pixels[indexLoc+0];// r value from the videovarg=video.pixels[indexLoc+1];// g value from the videovarb=video.pixels[indexLoc+2];// b value from the videopixels[indexLoc+0]=r;pixels[indexLoc+1]=g;pixels[indexLoc+2]=b;pixels[indexLoc+3]=255;// alpha value }}updatePixels();}
The text was updated successfully, but these errors were encountered:
when copying pixels from the video to my canvas, it looks like I am copying pixels from the video at the original size, not scaled down at 320x240. Maybe a Bug? Me running latest p5.js complete - March 4 2016 release on Mac OSX 10.11.3
But not just the scale is wrong, please see the image attached.
Now, since I remeber I sow something similar in processing, I found Daniel's code of the learning processing exercises ported in p5js, give them a try and they worked perfectly, so I decided to go line by line and see what was wrong with my code.
After 1 hour of complete frustration, I decided to change the only thing left: the libraries folder itself.
And It worked! As soon as I overwrite the DOM library with the older libraries, from the learning processing exercise, all problems are fixed.
Now, this is driving me crazy. What's going on? Is there a bug on the latest libraries of p5js?
following my code that replicates the one of the tutorial.
The text was updated successfully, but these errors were encountered: