OpenCV 2.4.3.1

org.opencv.android
Class JavaCameraView

java.lang.Object
  extended by SurfaceView
      extended by org.opencv.android.CameraBridgeViewBase
          extended by org.opencv.android.JavaCameraView

public class JavaCameraView
extends CameraBridgeViewBase

This class is an implementation of the Bridge View between OpenCV and Java Camera. This class relays on the functionality available in base class and only implements required functions: connectCamera - opens Java camera and sets the PreviewCallback to be delivered. disconnectCamera - closes the camera and stops preview. When frame is delivered via callback from Camera - it processed via OpenCV to be converted to RGBA32 and then passed to the external callback for modifications if required.


Nested Class Summary
static class JavaCameraView.JavaCameraSizeAccessor
           
 
Nested classes/interfaces inherited from class org.opencv.android.CameraBridgeViewBase
CameraBridgeViewBase.CvCameraViewListener, CameraBridgeViewBase.ListItemAccessor
 
Field Summary
protected  Camera mCamera
           
 
Fields inherited from class org.opencv.android.CameraBridgeViewBase
mCameraIndex, mEnabled, mFpsMeter, mFrameHeight, mFrameWidth, mMaxHeight, mMaxWidth, mPreviewFormat
 
Constructor Summary
JavaCameraView(Context context, AttributeSet attrs)
           
JavaCameraView(Context context, int cameraId)
           
 
Method Summary
protected  boolean connectCamera(int width, int height)
          This method is invoked shall perform concrete operation to initialize the camera.
protected  void disconnectCamera()
          Disconnects and release the particular camera object being connected to this surface view.
protected  boolean initializeCamera(int width, int height)
           
 void onPreviewFrame(byte[] frame, Camera arg1)
           
protected  void releaseCamera()
           
 
Methods inherited from class org.opencv.android.CameraBridgeViewBase
AllocateCache, calculateCameraFrameSize, deliverAndDrawFrame, disableFpsMeter, disableView, enableFpsMeter, enableView, SetCaptureFormat, setCvCameraViewListener, setMaxFrameSize, surfaceChanged, surfaceCreated, surfaceDestroyed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mCamera

protected Camera mCamera
Constructor Detail

JavaCameraView

public JavaCameraView(Context context,
                      AttributeSet attrs)

JavaCameraView

public JavaCameraView(Context context,
                      int cameraId)
Method Detail

connectCamera

protected boolean connectCamera(int width,
                                int height)
Description copied from class: CameraBridgeViewBase
This method is invoked shall perform concrete operation to initialize the camera. CONTRACT: as a result of this method variables mFrameWidth and mFrameHeight MUST be initialized with the size of the Camera frames that will be delivered to external processor.

Specified by:
connectCamera in class CameraBridgeViewBase
Parameters:
width - - the width of this SurfaceView
height - - the height of this SurfaceView

disconnectCamera

protected void disconnectCamera()
Description copied from class: CameraBridgeViewBase
Disconnects and release the particular camera object being connected to this surface view. Called when syncObject lock is held

Specified by:
disconnectCamera in class CameraBridgeViewBase

initializeCamera

protected boolean initializeCamera(int width,
                                   int height)

onPreviewFrame

public void onPreviewFrame(byte[] frame,
                           Camera arg1)

releaseCamera

protected void releaseCamera()

Official OpenCV 2.4 Documentation