We are about to switch to a new forum software. Until then we have removed the registration on this forum.
In Processing, I can get pixel data from an image or cam by calling the get method on the image or cam. However, this doesn't seem possible in the same way with P5js. In the reference, http://p5js.org/reference/#/p5/get, it seems that get doesn't work this way. It appears you can only get data from what the current canvas is showing as opposed to something that is not (such as an img or cam).
One solution may be to display the webcam feed (img or whatever) offscreen and use those offscreen pixel values to retrieve what you want. It seems kind of silly though. Am I missing something
Answers
When I use
image(capture, 0, 0, capture.width, capture.height);
it produces the image like it should, yet when I useconsole.log(capture.get(20, 20);
, I get the error, "Uncaught TypeError: Cannot read property 'get' of undefined."Any ideas?
Maybe after learning a bit more I can ask a more intelligent question:
.get cannot be called on the cam because the cam/capture object is NOT an image object. Correct?
But I can use Image() to display the stream, updating it in draw each frame. So it must be an image. But then why won't .get() work on it?
For the record, this was resolved here:
https://github.com/processing/p5.js/issues/855