ketai.camera

## Class KetaiCamera

- java.lang.Object
- - processing.core.PImage
  - - ketai.camera.KetaiCamera

- All Implemented Interfaces:
    java.lang.Cloneable, processing.core.PConstants

      public class KetaiCamera
      extends processing.core.PImage

  The Class KetaiCamera allows the processing sketches to access android cameras through an object modeled after the desktop/java processing Camera class.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.lang.Object` | `callbackdelegate`
    `boolean` | `enableFlash` The is rgb preview supported.
    `boolean` | `isRGBPreviewSupported` The is rgb preview supported.
    `boolean` | `isStarted` The is rgb preview supported.
    `protected java.lang.reflect.Method` | `onFaceDetectionEventMethod` The on face detection event method.
    `protected java.lang.reflect.Method` | `onPreviewEventMethod` The on face detection event method.
    `protected java.lang.reflect.Method` | `onPreviewEventMethodPImage` The on face detection event method.
    `protected java.lang.reflect.Method` | `onSavePhotoEventMethod` The on face detection event method.
    `boolean` | `requestedPortraitImage`
    `boolean` | `requestedStart` The is rgb preview supported.

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

      `ALPHA_MASK, bitmap, BLUE_MASK, cacheMap, format, GREEN_MASK, height, loaded, modified, mx1, mx2, my1, my2, paramMap, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, saveImageFormats, width`

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

      `ADD, ALPHA, AMBIENT, ARC, ARGB, BACK, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CHORD, CLAMP, CLOSE, CMYK, CODED, COMPLAINT, CORNER, CORNERS, 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_COORDINATES, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DPAD, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_COORDINATES, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GROUP, HALF_PI, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MENU, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, 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, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TAU, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WHITESPACE, WINDOWS, X, Y, YUV420, Z`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KetaiCamera(processing.core.PApplet pParent, int _width, int _height, int _framesPerSecond)` Instantiates a new ketai camera.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addToMediaLibrary(java.lang.String _file)` Adds the file to media library so that other applications can access it.
    `void` | `autoSettings()` Auto settings - set camera to use auto adjusting settings
    `void` | `decodeYUV420SP(byte[] yuv420sp)` Decode yuv420 sp.
    `void` | `disableFlash()` Disable flash.
    `void` | `dispose()` Dispose.
    `java.lang.String` | `dump()` Dump out camera settings into a single string.
    `void` | `enableFlash()` Enable flash.
    `int` | `getCameraID()` Gets the camera id.
    `int` | `getNumberOfCameras()` Gets the number of cameras.
    `int` | `getPhotoHeight()` Gets the photo height which may be different from the camera preview width since photo quality can be better than preview/camera image.
    `int` | `getPhotoWidth()` Gets the photo width which may be different from the camera preview width since photo quality can be better than preview/camera image.
    `int` | `getZoom()` Gets the zoom.
    `boolean` | `isFlashEnabled()` Checks if flash is enabled.
    `boolean` | `isStarted()` Checks if the camera has been started.
    `java.util.Collection<? extends java.lang.String>` | `list()` List available cameras.
    `void` | `manualSettings()` Manual settings - attempt to disable "auto" adjustments (like focus, white balance, etc).
    `void` | `onFrameAvailable(android.graphics.SurfaceTexture arg0)` On frame available callback, used by the camera service.
    `void` | `onPermissionResult(boolean granted)`
    `void` | `pause()` Pause the class as since the activity is being paused.
    `void` | `read()` Read the pixels from the camera.
    `void` | `register(java.lang.Object o)`
    `void` | `resume()` Resume.
    `boolean` | `savePhoto()` Saves photo to the file system using default settings (
    `boolean` | `savePhoto(java.lang.String _filename)` Save photo to the file system using the name provided.
    `void` | `setCameraID(int _id)` Sets the camera id for devices that support multiple cameras.
    `void` | `setPhotoSize(int width, int height)` Sets the photo dimensions.
    `void` | `setSaveDirectory(java.lang.String _dirname)` Sets the save directory for image/photo settings
    `void` | `setZoom(int _zoom)` Sets the zoom.
    `boolean` | `start()` Start the camera preview.
    `void` | `stop()` Stop the camera from receiving updates.

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

      `blend, blend, blendColor, blurAlpha, blurARGB, blurRGB, buildBlurKernel, checkAlpha, clone, copy, copy, dilate, filter, filter, get, get, get, getImpl, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getNative, init, isLoaded, isModified, loadPixels, loadTIFF, mask, mask, resize, save, saveTGA, saveTIFF, set, set, setImpl, setLoaded, setLoaded, setModified, setModified, setNative, updatePixels, updatePixels, updatePixelsImpl`

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

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

- - ### Field Detail

    - #### onPreviewEventMethod

          protected java.lang.reflect.Method onPreviewEventMethod

      The on face detection event method.

    - #### onPreviewEventMethodPImage

          protected java.lang.reflect.Method onPreviewEventMethodPImage

      The on face detection event method.

    - #### onSavePhotoEventMethod

          protected java.lang.reflect.Method onSavePhotoEventMethod

      The on face detection event method.

    - #### onFaceDetectionEventMethod

          protected java.lang.reflect.Method onFaceDetectionEventMethod

      The on face detection event method.

    - #### isStarted

          public boolean isStarted

      The is rgb preview supported.

    - #### requestedStart

          public boolean requestedStart

      The is rgb preview supported.

    - #### enableFlash

          public boolean enableFlash

      The is rgb preview supported.

    - #### isRGBPreviewSupported

          public boolean isRGBPreviewSupported

      The is rgb preview supported.

    - #### callbackdelegate

          public java.lang.Object callbackdelegate

    - #### requestedPortraitImage

          public boolean requestedPortraitImage

  - ### Constructor Detail

    - #### KetaiCamera

          public KetaiCamera(processing.core.PApplet pParent,
                             int _width,
                             int _height,
                             int _framesPerSecond)

      Instantiates a new ketai camera.
      Parameters:
        `pParent` - reference to the main sketch(Activity)
        `_width` - width of the camera image
        `_height` - height of the camera image
        `_framesPerSecond` - the frames per second

  - ### Method Detail

    - #### onPermissionResult

          public void onPermissionResult(boolean granted)

    - #### manualSettings

          public void manualSettings()

      Manual settings - attempt to disable "auto" adjustments (like focus, white balance, etc).

    - #### setZoom

          public void setZoom(int _zoom)

      Sets the zoom.
      Parameters:
        `_zoom` - the new zoom

    - #### getZoom

          public int getZoom()

      Gets the zoom.
      Returns:
        the zoom

    - #### autoSettings

          public void autoSettings()

      Auto settings - set camera to use auto adjusting settings

    - #### dump

          public java.lang.String dump()

      Dump out camera settings into a single string.
      Returns:
        the string

    - #### setSaveDirectory

          public void setSaveDirectory(java.lang.String _dirname)

      Sets the save directory for image/photo settings
      Parameters:
        `_dirname` - the new save directory

    - #### getPhotoWidth

          public int getPhotoWidth()

      Gets the photo width which may be different from the camera preview width since photo quality can be better than preview/camera image.
      Returns:
        the photo width

    - #### getPhotoHeight

          public int getPhotoHeight()

      Gets the photo height which may be different from the camera preview width since photo quality can be better than preview/camera image.
      Returns:
        the photo height

    - #### setPhotoSize

          public void setPhotoSize(int width,
                                   int height)

      Sets the photo dimensions. Photo dimensions default to camera preview dimensions but can be set for higher quality. Typically camera preview dimensions should be smaller than photo dimensions.
      Parameters:
        `width` - the width
        `height` - the height

    - #### enableFlash

          public void enableFlash()

      Enable flash.

    - #### disableFlash

          public void disableFlash()

      Disable flash.

    - #### setCameraID

          public void setCameraID(int _id)

      Sets the camera id for devices that support multiple cameras.
      Parameters:
        `_id` - the new camera id

    - #### getCameraID

          public int getCameraID()

      Gets the camera id.
      Returns:
        the camera id

    - #### start

          public boolean start()

      Start the camera preview. Call this in order to start the camera preview updates. This will deliver pixels from the camera to the parent sketch.
      Returns:
        true, if successful

    - #### isFlashEnabled

          public boolean isFlashEnabled()

      Checks if flash is enabled.
      Returns:
        true, if flash is enabled

    - #### savePhoto

          public boolean savePhoto()

      Saves photo to the file system using default settings (
      Returns:
        true, if successful

    - #### savePhoto

          public boolean savePhoto(java.lang.String _filename)

      Save photo to the file system using the name provided.
      Parameters:
        `_filename` - the _filename
      Returns:
        true, if successful

    - #### resume

          public void resume()

      Resume.

    - #### read

          public void read()

      Read the pixels from the camera.

    - #### isStarted

          public boolean isStarted()

      Checks if the camera has been started.
      Returns:
        true, if is started

    - #### addToMediaLibrary

          public void addToMediaLibrary(java.lang.String _file)

      Adds the file to media library so that other applications can access it.
      Parameters:
        `_file` - the _file

    - #### pause

          public void pause()

      Pause the class as since the activity is being paused.

    - #### stop

          public void stop()

      Stop the camera from receiving updates.

    - #### dispose

          public void dispose()

      Dispose.

    - #### decodeYUV420SP

          public void decodeYUV420SP(byte[] yuv420sp)

      Decode yuv420 sp.
      Parameters:
        `yuv420sp` - the yuv420sp

    - #### getNumberOfCameras

          public int getNumberOfCameras()

      Gets the number of cameras.
      Returns:
        the number of cameras

    - #### list

          public java.util.Collection<? extends java.lang.String> list()

      List available cameras.
      Returns:
        the collection

    - #### onFrameAvailable

          public void onFrameAvailable(android.graphics.SurfaceTexture arg0)

      On frame available callback, used by the camera service.
      Parameters:
        `arg0` - the arg0

    - #### register

          public void register(java.lang.Object o)