SHARE
TWEET

SimpleCamera.pde

a guest Mar 4th, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import processing.video.*;
  2.  
  3. Capture cam;
  4. int switcher = 0;
  5.  
  6. void setup(){
  7. size(640,480);
  8. cam = new Capture(this, 640, 480);
  9. cam.start();
  10. }
  11.  
  12. void draw(){
  13.   tint(256,256,256);
  14.   background(0);
  15.  
  16.  
  17.  
  18.  if (cam.available()){
  19.     cam.read();
  20.  }
  21.  if(switcher==0){
  22.  image(cam,0,0);
  23.  }
  24.  
  25.  else if(switcher == 1){
  26.  scale(-1,1);
  27.  image(cam,-width,0);
  28.  }
  29.  
  30. else if(switcher == 2){
  31.  scale(-1,-1);
  32.  image(cam,-width,-height);
  33.  }
  34.  
  35. else if(switcher == 3){
  36.   //show 4 images
  37.   //change their colors
  38.  
  39.   tint(256, 0, 0);
  40.   image(cam, 0, 0, width/2, height/2);
  41.  
  42.   tint(0, 256, 0);
  43.   image(cam, width/2, 0, width/2, height/2);
  44.  
  45.   tint(0, 0, 256);
  46.   image(cam, 0, height/2, width/2, height/2);
  47.  
  48.   tint(256, 0, 256);
  49.   image(cam, width/2, height/2, width/2, height/2);
  50.  
  51.  }
  52.  
  53. else if(switcher==4 ){
  54.  
  55.  image(cam, mouseX,mouseY, width/2, height/2);
  56.  }
  57.  
  58.  
  59.  else{
  60.    println("Switcher = 0 again");
  61.    switcher = 0;
  62.  }
  63.  
  64. }
  65.  
  66. void mousePressed(){
  67.   switcher++;
  68.  
  69.  
  70.  
  71. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top