예제 #1
0
 public void draw() {
   if (cam.available()) {
     cam.read();
     image(cam, 0, 0);
     text("Click to upload to Flickr", 10, height - 13);
   }
   fill(255, 0, 0);
   rect(0, 0, 25, 25);
 }
예제 #2
0
  public void setup() {
    size(320, 240);

    String[] devices = Capture.list();
    println(devices);
    // Set up the camera.
    //  cam = new Capture(this, 320, 240);
    cam = new Capture(this, width, height, devices[10]);

    // cam.start();
    // Set up Flickr.
    flickr = new Flickr(apiKey, secretKey, (new Flickr(apiKey)).getTransport());

    // Authentication is the hard part.
    // If you're authenticating for the first time, this will open up
    // a web browser with Flickr's authentication web page and ask you to
    // give the app permission. You'll have 15 seconds to do this before the Processing app
    // gives up waiting fr you.

    // After the initial authentication, your info will be saved locally in a text file,
    // so you shouldn't have to go through the authentication song and dance more than once
    authenticate();

    // Create an uploader
    uploader = flickr.getUploader();
  }
예제 #3
0
  public void setup() {
    webcam = new Capture(this, width, height);
    cv = new OpenCV(this, width, height);

    webcam.start();

    cv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
  }
예제 #4
0
파일: vidsk.java 프로젝트: Gradonhf/ATP
  public void draw() {
    if (cam.available() == true) {
      cam.read();
      pushMatrix();
      scale(-1, 1);
      translate(-cam.width, 0);
      image(cam, 0, 0);
      popMatrix();

      // image(cam, 0,0);
      try {
        // Now test to see if it has a QR code embedded in it
        LuminanceSource source = new BufferedImageLuminanceSource((BufferedImage) cam.getImage());
        BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
        Result result = reader.decode(bitmap);
        // Once we get the results, we can do some display
        if (result.getText() != null) {
          println(result.getText());
          ResultPoint[] points = result.getResultPoints();
          // Draw some ellipses on at the control points
          for (int i = 0; i < points.length; i++) {
            // fill(#ff8c00);
            ellipse(points[i].getX(), points[i].getY(), 20, 20);
            // fill(#ff0000);
            text(i, points[i].getX(), points[i].getY());
          }
          // Now fetch the book cover, if it is found
          if (!result.getText().equals(lastISBNAcquired)) {
            String url = "http://covers.oreilly.com/images/" + result.getText() + "/cat.gif";
            try {
              cover = loadImage(url, "gif");
              lastISBNAcquired = result.getText();
            } catch (Exception e) {
              cover = null;
            }
          }
          // Superimpose the cover on the image
          if (cover != null) {
            image(cover, points[1].getX(), points[1].getY());
          }
        }
      } catch (Exception e) {
        //         println(e.toString());
      }
    }
  }
예제 #5
0
파일: vidsk.java 프로젝트: Gradonhf/ATP
  public void setup() {
    size(640, 480);
    PFont metaBold;
    // The font "Meta-Bold.vlw" must be located in the
    // current sketch's "data" directory to load successfully
    metaBold = loadFont("SansSerif-48.vlw");
    textFont(metaBold, 36);

    cam = new Capture(this, WIDTH, HEIGHT);
    cam.start();
  }
예제 #6
0
 public void captureEvent(Capture c) {
   c.read();
 }