Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

How to redefine the Capture object?

$
0
0

Good day.

I want to make it possible to reconnect the camera which is bound to the Capture object during the program works. So, it's just a button on the screen and when you click it the camera should be changed. Actually, now there is no matter if it connects to a new or the previous one. That's the truncated part of the code:

import processing.video.Capture; Capture wirelessCam; void setup() { fullScreen(); smooth(); frameRate(60); connect(); } void draw() { background(#000000); if (wirelessCam.available()) wirelessCam.read(); image(wirelessCam, 0, 0); } void connect() { wirelessCam = new Capture(this, Capture.list()[0]); wirelessCam.start(); } void mouseClicked() { connect(); }

Seems to be an easy block of code working correctly, but, in fact, it isn't. The first time when the program is launched it really shows the webcam video stream. But as only you click the mouse the whole program breaks down - instead of the expected video image you see a lonely useless rectangle the same color as the background.

I've done my best to solve the proplem, combining the functions sequences and adding/removing some parts of code. Unfortunately, I managed to do nothing. Literally, NOTHING.

I will be very grateful to your ideas and any kind of help. Thanks.


Viewing all articles
Browse latest Browse all 2896

Trending Articles