Capture image from a small portion of screen

edited February 2016 in Library Questions

Hi, I have created a large interface with a small portion dedicated to my webcam capture. The problem I am facing is that when ever I attempt to save an image for my webcam, the entirety of my interface is saved. How can I save just a selected area of my screen? The relevant code is given below. (I should note that I have created a button to save the images)

`import processing.video.*;

Capture cam;

void setup() {
  size (1600,800);
  cam =  new Capture(this, "name=Logitech HD Webcam C270,size=352x288,fps=30");
  cam.start();

}
void captureEvent(Capture cam) {
cam.read();
}

void draw() {
  background(#BCBCB8);
   image(cam , 1100, 100);
   fill(126,131,245);
   stroke(255);
   rect(1200,450,150,50);

   String s2 = "Capture Image"; 
  stroke(5,5,5); 
  fill(5,5,5);
  textSize(20); 
  text( s2, 1203,480);



    }


void mousePressed() {

  if(mouseX>1200 && mouseX < 1350 && mouseY>440 && mouseY < 500){
  saveFrame("captured_image-##.jpg");


  }
}



  `
Sign In or Register to comment.