project.android.imageprocessing.input
Class CameraPreviewInput

java.lang.Object
  extended by project.android.imageprocessing.GLRenderer
      extended by project.android.imageprocessing.input.GLTextureOutputRenderer
          extended by project.android.imageprocessing.input.CameraPreviewInput
All Implemented Interfaces:
android.graphics.SurfaceTexture.OnFrameAvailableListener

public class CameraPreviewInput
extends GLTextureOutputRenderer
implements android.graphics.SurfaceTexture.OnFrameAvailableListener

A Camera input extension of CameraPreviewInput. This class takes advantage of the android camera preview to produce new textures for processing.

Note: This class requires an API level of at least 14. To change camera parameters or get access to the camera directly before it is used by this class, createCamera() can be override.

Author:
Chris Batt

Field Summary
 
Fields inherited from class project.android.imageprocessing.GLRenderer
ATTRIBUTE_POSITION, ATTRIBUTE_TEXCOORD, UNIFORM_TEXTURE0, VARYING_TEXCOORD
 
Constructor Summary
CameraPreviewInput(android.opengl.GLSurfaceView view)
          Creates a CameraPreviewInput which captures the camera preview with all the default camera parameters and settings.
 
Method Summary
 void destroy()
          Cleans up the opengl objects for this renderer.
 void onFrameAvailable(android.graphics.SurfaceTexture arg0)
           
 void onPause()
          Closes and releases the camera for other applications to use.
 void onResume()
          Re-initializes the camera and starts the preview again.
 
Methods inherited from class project.android.imageprocessing.input.GLTextureOutputRenderer
addTarget, getLockObject, getTargets, removeTarget
 
Methods inherited from class project.android.imageprocessing.GLRenderer
getBackgroundAlpha, getBackgroundBlue, getBackgroundGreen, getBackgroundRed, getHeight, getWidth, onDrawFrame, reInitialize, rotateClockwise90Degrees, rotateCounterClockwise90Degrees, setBackgroundAlpha, setBackgroundBlue, setBackgroundColour, setBackgroundGreen, setBackgroundRed, setRenderSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CameraPreviewInput

public CameraPreviewInput(android.opengl.GLSurfaceView view)
Creates a CameraPreviewInput which captures the camera preview with all the default camera parameters and settings.

Method Detail

destroy

public void destroy()
Description copied from class: GLRenderer
Cleans up the opengl objects for this renderer. Must be called with opengl context. Normally called by FastImageProcessingPipeline.

Overrides:
destroy in class GLTextureOutputRenderer

onFrameAvailable

public void onFrameAvailable(android.graphics.SurfaceTexture arg0)
Specified by:
onFrameAvailable in interface android.graphics.SurfaceTexture.OnFrameAvailableListener

onPause

public void onPause()
Closes and releases the camera for other applications to use. Should be called when the pause is called in the activity.


onResume

public void onResume()
Re-initializes the camera and starts the preview again. Should be called when resume is called in the activity.