I have the following code. It displays filter video at top and original video at bottom.
How to hide the video at the top?
Thanks
// https://editor.p5js.org/
function setup() {
createCanvas(320, 260);
video = createCapture(VIDEO);
video.size(width,height);
}
let video;
function draw() {
image(video,0,0,width,height);
// filter(THRESHOLD);
// filter(GRAY);
filter(INVERT);
}
Thank you @Samathingamajig
The following Code works for me.
let video;
function setup() {
createCanvas(320, 260);
video = createCapture(VIDEO);
video.size(width, height);
video.hide();
}
function draw() {
image(video,0,0,width,height);
// rest of code
}
Can we redefine it as below?
// https://editor.p5js.org/
function setup() {
createCanvas(700, 394);
video = createCapture(VIDEO);
video.hide();
// video.show();
}
let video;
function draw() {
image(video,0,0,width,height);
// filter(THRESHOLD);
// filter(GRAY);
// filter(INVERT);
}
On the documenation page, it says to do video.hide() to hide the webcam capture.
And if you don't want the filter, then don't call filter(...)
So your code will look like this:
let video;
function setup() {
createCanvas(320, 260);
video = createCapture(VIDEO);
video.size(width, height);
video.hide();
}
function draw() {
image(video,0,0,width,height);
// rest of code
}
If you ever want to reshow the original video, just run video.show().