processing.video

## Class Capture

- java.lang.Object
- - processing.core.PImage
  - - processing.video.Capture

- All Implemented Interfaces:
    Cloneable, PConstants

      public class Capture
      extends PImage
      implements PConstants

  ( begin auto-generated from Capture.xml ) Datatype for storing and manipulating video frames from an attached capture device such as a camera. Use Capture.list() to show the names of any attached devices. Using the version of the constructor without name will attempt to use the last device used by a QuickTime program. ( end auto-generated )

  ### Advanced

  Class for storing and manipulating video frames from an attached capture device such as a camera.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `float` | `frameRate`
    `org.gstreamer.Pipeline` | `pipeline`

    - ### Fields inherited from class processing.core.PImage

      `ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, width`

    - ### Fields inherited from interface processing.core.PConstants

      `ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Capture(PApplet parent)`
    `Capture(PApplet parent, int requestWidth, int requestHeight)`
    `Capture(PApplet parent, int requestWidth, int requestHeight, int frameRate)` Advanced
    `Capture(PApplet parent, int requestWidth, int requestHeight, String cameraName)` Advanced
    `Capture(PApplet parent, int requestWidth, int requestHeight, String cameraName, int frameRate)` Advanced
    `Capture(PApplet parent, String requestConfig)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `available()` ( begin auto-generated from Capture_available.xml ) Returns "true" when a new video frame is available to read.
    `void` | `dispose()` Disposes all the native resources associated to this capture device.
    `void` | `disposeBuffer(Object buf)` NOTE: This is not official API and may/will be removed at any time.
    `int` | `get(int x, int y)`
    `boolean` | `hasBufferSink()` NOTE: This is not official API and may/will be removed at any time.
    `static String[]` | `list()` ( begin auto-generated from Capture_list.xml ) Gets a list of all available capture devices such as a camera.
    `void` | `loadPixels()`
    `void` | `post()`
    `void` | `read()` ( begin auto-generated from Capture_read.xml ) Reads the current video frame.
    `void` | `setBufferSink(Object sink)` Sets the object to use as destination for the frames read from the stream.
    `void` | `setBufferSink(Object sink, String mask)` Sets the object to use as destination for the frames read from the stream.
    `void` | `start()` ( begin auto-generated from Capture_start.xml ) Starts capturing frames from the selected device.
    `void` | `stop()` ( begin auto-generated from Capture_stop.xml ) Stops capturing frames from an attached device.

    - ### Methods inherited from class processing.core.PImage

      `blend, blend, blendColor, clone, copy, copy, copy, filter, filter, get, get, getImage, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getNative, init, init, isLoaded, isModified, mask, mask, resize, save, set, set, setLoaded, setLoaded, setModified, setModified, updatePixels, updatePixels`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### frameRate

          public float frameRate

    - #### pipeline

          public org.gstreamer.Pipeline pipeline

  - ### Constructor Detail

    - #### Capture

          public Capture(PApplet parent)

    - #### Capture

          public Capture(PApplet parent,
                         String requestConfig)

    - #### Capture

          public Capture(PApplet parent,
                         int requestWidth,
                         int requestHeight)

      Parameters:
        `parent` - typically use "this"
        `requestWidth` - width of the frame
        `requestHeight` - height of the frame

    - #### Capture

          public Capture(PApplet parent,
                         int requestWidth,
                         int requestHeight,
                         int frameRate)

      ### Advanced

      Constructor that takes resolution and framerate.
      Parameters:
        `frameRate` - number of frames to read per second

    - #### Capture

          public Capture(PApplet parent,
                         int requestWidth,
                         int requestHeight,
                         String cameraName)

      ### Advanced

      This constructor allows to specify resolution and camera name.
      Parameters:
        `cameraName` - name of the camera

    - #### Capture

          public Capture(PApplet parent,
                         int requestWidth,
                         int requestHeight,
                         String cameraName,
                         int frameRate)

      ### Advanced

      This constructor allows to specify the camera name and the desired framerate, in addition to the resolution.

  - ### Method Detail

    - #### dispose

          public void dispose()

      Disposes all the native resources associated to this capture device. NOTE: This is not official API and may/will be removed at any time.

    - #### available

          public boolean available()

      ( begin auto-generated from Capture_available.xml ) Returns "true" when a new video frame is available to read. ( end auto-generated )

    - #### start

          public void start()

      ( begin auto-generated from Capture_start.xml ) Starts capturing frames from the selected device. ( end auto-generated )

    - #### stop

          public void stop()

      ( begin auto-generated from Capture_stop.xml ) Stops capturing frames from an attached device. ( end auto-generated )

    - #### read

          public void read()

      ( begin auto-generated from Capture_read.xml ) Reads the current video frame. ( end auto-generated )

      ### Advanced

      This method() and invokeEvent() are now synchronized, so that invokeEvent() can't be called whilst we're busy reading. Problematic frame error fixed by Charl P. Botha

    - #### loadPixels

          public void loadPixels()

      Overrides:
        `loadPixels` in class `PImage`

    - #### get

          public int get(int x,
                         int y)

      Overrides:
        `get` in class `PImage`

    - #### list

          public static String[] list()

      ( begin auto-generated from Capture_list.xml ) Gets a list of all available capture devices such as a camera. Use print() to write the information to the text window. ( end auto-generated )

    - #### setBufferSink

          public void setBufferSink(Object sink)

      Sets the object to use as destination for the frames read from the stream. The color conversion mask is automatically set to the one required to copy the frames to OpenGL. NOTE: This is not official API and may/will be removed at any time.
      Parameters:
        `Object` - dest

    - #### setBufferSink

          public void setBufferSink(Object sink,
                                    String mask)

      Sets the object to use as destination for the frames read from the stream. NOTE: This is not official API and may/will be removed at any time.
      Parameters:
        `Object` - dest
        `String` - mask

    - #### hasBufferSink

          public boolean hasBufferSink()

      NOTE: This is not official API and may/will be removed at any time.

    - #### disposeBuffer

          public void disposeBuffer(Object buf)

      NOTE: This is not official API and may/will be removed at any time.

    - #### post

          public void post()

Processing video library by The Processing Foundation. (c) 2011-14