OpenCV 2.4.7.1

org.opencv.android
Class CameraBridgeViewBase

java.lang.Object
  extended by SurfaceView
      extended by org.opencv.android.CameraBridgeViewBase
Direct Known Subclasses:
JavaCameraView, NativeCameraView

public abstract class CameraBridgeViewBase
extends SurfaceView

This is a basic class, implementing the interaction with Camera and OpenCV library. The main responsibility of it - is to control when camera can be enabled, process the frame, call external listener to make any adjustments to the frame and then draw the resulting frame to the screen. The clients shall implement CvCameraViewListener.


Nested Class Summary
static interface CameraBridgeViewBase.CvCameraViewFrame
          This class interface is abstract representation of single frame from camera for onCameraFrame callback Attention: Do not use objects, that represents this interface out of onCameraFrame callback!
static interface CameraBridgeViewBase.CvCameraViewListener
           
static interface CameraBridgeViewBase.CvCameraViewListener2
           
static interface CameraBridgeViewBase.ListItemAccessor
           
 
Field Summary
static int CAMERA_ID_ANY
           
static int CAMERA_ID_BACK
           
static int CAMERA_ID_FRONT
           
 
Constructor Summary
CameraBridgeViewBase(Context context, AttributeSet attrs)
           
CameraBridgeViewBase(Context context, int cameraId)
           
 
Method Summary
 void disableFpsMeter()
           
 void disableView()
          This method is provided for clients, so they can disable camera connection and stop the delivery of frames even though the surface view itself is not destroyed and still stays on the scren
 void enableFpsMeter()
          This method enables label with fps value on the screen
 void enableView()
          This method is provided for clients, so they can enable the camera connection.
 void setCameraIndex(int cameraIndex)
          Sets the camera index
 void SetCaptureFormat(int format)
           
 void setCvCameraViewListener(CameraBridgeViewBase.CvCameraViewListener listener)
           
 void setCvCameraViewListener(CameraBridgeViewBase.CvCameraViewListener2 listener)
           
 void setMaxFrameSize(int maxWidth, int maxHeight)
          This method sets the maximum size that camera frame is allowed to be.
 void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3)
           
 void surfaceCreated(SurfaceHolder holder)
           
 void surfaceDestroyed(SurfaceHolder holder)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAMERA_ID_ANY

public static final int CAMERA_ID_ANY
See Also:
Constant Field Values

CAMERA_ID_BACK

public static final int CAMERA_ID_BACK
See Also:
Constant Field Values

CAMERA_ID_FRONT

public static final int CAMERA_ID_FRONT
See Also:
Constant Field Values
Constructor Detail

CameraBridgeViewBase

public CameraBridgeViewBase(Context context,
                            AttributeSet attrs)

CameraBridgeViewBase

public CameraBridgeViewBase(Context context,
                            int cameraId)
Method Detail

disableFpsMeter

public void disableFpsMeter()

disableView

public void disableView()
This method is provided for clients, so they can disable camera connection and stop the delivery of frames even though the surface view itself is not destroyed and still stays on the scren


enableFpsMeter

public void enableFpsMeter()
This method enables label with fps value on the screen


enableView

public void enableView()
This method is provided for clients, so they can enable the camera connection. The actual onCameraViewStarted callback will be delivered only after both this method is called and surface is available


setCameraIndex

public void setCameraIndex(int cameraIndex)
Sets the camera index

Parameters:
cameraIndex - new camera index

SetCaptureFormat

public void SetCaptureFormat(int format)

setCvCameraViewListener

public void setCvCameraViewListener(CameraBridgeViewBase.CvCameraViewListener listener)

setCvCameraViewListener

public void setCvCameraViewListener(CameraBridgeViewBase.CvCameraViewListener2 listener)
Parameters:
listener -

setMaxFrameSize

public void setMaxFrameSize(int maxWidth,
                            int maxHeight)
This method sets the maximum size that camera frame is allowed to be. When selecting size - the biggest size which less or equal the size set will be selected. As an example - we set setMaxFrameSize(200,200) and we have 176x152 and 320x240 sizes. The preview frame will be selected with 176x152 size. This method is useful when need to restrict the size of preview frame for some reason (for example for video recording)

Parameters:
maxWidth - - the maximum width allowed for camera frame.
maxHeight - - the maximum height allowed for camera frame

surfaceChanged

public void surfaceChanged(SurfaceHolder arg0,
                           int arg1,
                           int arg2,
                           int arg3)

surfaceCreated

public void surfaceCreated(SurfaceHolder holder)

surfaceDestroyed

public void surfaceDestroyed(SurfaceHolder holder)

OpenCV 2.4.7.1 Documentation