added WebCam

This commit is contained in:
2024-04-12 13:11:56 +02:00
parent 92a72d1851
commit 097a66643a
11 changed files with 113 additions and 22 deletions

View File

@@ -38,7 +38,8 @@ class SourceManager { //no constructor
void setImage(PImage img) { //set image to source
imageChanged = true;
source = img.get();
if(!webcamMode)fallbackImage = source;
//if(!webcamMode) fallbackImage = source;
fallbackImage = source;
nativeResoX = source.width;
nativeResoY = source.height;
//println(nativeResoX);
@@ -48,7 +49,7 @@ class SourceManager { //no constructor
println("Fallback");
setImage(fallbackImage); //fallbackImage should always be a copy of the last image that worked
}
/*
void startWebcam() {
String[] cameras = Capture.list();
println(cameras);
@@ -58,15 +59,17 @@ class SourceManager { //no constructor
void stopWebcam() {
cam.stop();
webcamMode = false;
}
}*/
void update() {
/*
if (webcamMode) {
if (cam.available()) {
cam.read();
setImage(cam);
}
}
*/
if (source == null) {
fallback();
@@ -123,7 +126,7 @@ class SourceManager { //no constructor
if (isImage(path) || isVideo(path)) {
println("Importing file " + path);
if (moviePlaying) movie.stop();
if (webcamMode) gui.webcam.setValue(false);
//if (webcamMode) gui.webcam.setValue(false);
if (isImage(path)) {
moviePlaying = false;
setImage(loadImage(path));