Reference for Processing version 1.1+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, »please let us know. If you prefer a more technical reference, visit the »Processing Javadoc.

Class | Capture

Name

### crop()

Examples

    import processing.video.*;
    Capture myCapture;

    void setup()
    {
      size(200, 200);
      print(myCapture.list());
      String s = "Logitech QuickCam Zoom-WDM";
      myCapture = new Capture(this, s, width, height, 30);
      myCapture.crop(10, 10, 180, 180);
    }

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

    void draw() {
      image(myCapture, 10, 10);
    }

Description

Crops the frame coming in from the camera. It seems common for cameras add lines to the top or bottom of an image and this can be useful for removing them. The parameters are affected by the current imageMode() from the parent applet. The imageMode() function changes the way the parameters work. For example, imageMode(CENTER) will change x and y to define the center of the image. A call to imageMode(CORNERS) will change the width and height parameters to define the x and y values of the opposite corner of the image.

Syntax

    cam.crop(x, y, width, height)

Parameters

cam | any variable of type Capture
x | int or float: x-coordinate of the image
y | int or float: y-coordinate of the image
width | int or float: width to display the image
height | int or float: width to display the image

Usage | Web & Application

Updated on June 14, 2010 12:05:23pm EDT