Advertisement
Guest User

Untitled

a guest
Jul 1st, 2018
107
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None
  1. PImage scaledImg;
  2. PImage differenceImg;
  3.  
  4. // size of the webcam capture depends your camera
  5. int captureWidth = 640;
  6. int captureHeight = 480;
  7.  
  8. int cvWidth;
  9. int cvHeight;
  10.  
  11. int rows = 3; // rows
  12. int cols = 4; // cols
  13.  
  14. Capture camera;
  15.  
  16. void setupCam() {
  17.  
  18. // make sure the draw runs one time to display the "waiting" text
  19. if(frameCount<2) return;
  20.  
  21. println("Checking for webcam");
  22.  
  23. String[] cameras = Capture.list();
  24.  
  25. if (cameras.length == 0) {
  26. println("There are no cameras available for capture.");
  27. exit();
  28. }
  29. else {
  30. println("Available cameras:");
  31. // printArray(cameras);
  32.  
  33. // The camera can be initialized directly using an element from the array returned by list();
  34. //cam = new Capture(this, cameras[camNumber]);
  35. int camNumber = 4;
  36. camera = new Capture(this, captureWidth, captureHeight, cameras[camNumber]);
  37.  
  38. // Start capturing the images from the camera
  39. camera.start();
  40.  
  41. while(camera.available() != true) {
  42. delay(1);//println("waiting for camera");
  43. }
  44.  
  45. cameraInitDone = true;
  46.  
  47. }
  48. }
Advertisement
RAW Paste Data Copied
Advertisement