Save Webcam Image
in
Programming Questions
•
2 years ago
Hello guys,
I have a question how can I save a Webcamimage with Processing.
In my programm I first make a new camera objekt and get some variables from arduino and paint the webcam image in different colors. In the last if funktion (else if (val==53)) i want that the current webcamimage is saved. How do I do that?
Here is my code:
I have a question how can I save a Webcamimage with Processing.
In my programm I first make a new camera objekt and get some variables from arduino and paint the webcam image in different colors. In the last if funktion (else if (val==53)) i want that the current webcamimage is saved. How do I do that?
Here is my code:
- import processing.serial.*;
- import JMyron.*;
- Serial port;
- int val;
- JMyron m; //a camera object
- PImage gImage;
- void setup(){
- size(800,800);
- port = new Serial (this, "COM12", 9600);
- m = new JMyron();//make a new instance of the object
- gImage = new PImage(width,height);
- m.start(width,height);
- }
- void draw(){
- m.update();
- gImage.loadPixels();
- gImage.pixels = m.image();
- gImage.updatePixels();
- image (gImage,0,0);
- tint(255,255,255);
- while(port.available() > 0){
- int val = port.read();
- println(val);
- if (val==49){
- image (gImage,0,0);
- tint(255,255,0);
- delay(500);
- }
- else if (val==50){
- image (gImage,400,0);
- tint(255,0,0);
- delay(500);
- }
- else if (val==51){
- image (gImage,0,400);
- tint(0,255,0);
- delay(500);
- }
- else if (val==52){
- image (gImage,400,400);
- tint(0,0,255);
- delay(500);
- }
- else if (val==53){
- }
- }
- }
1