|
OpenCV 2.4.3 (RC) | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SurfaceView org.opencv.android.CameraBridgeViewBase
public abstract class CameraBridgeViewBase
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 TODO: add method to control the format in which the frames will be delivered to CvCameraViewListener
Nested Class Summary | |
---|---|
static interface |
CameraBridgeViewBase.CvCameraViewListener
|
static interface |
CameraBridgeViewBase.ListItemAccessor
|
Field Summary | |
---|---|
protected int |
mFrameHeight
|
protected int |
mFrameWidth
|
protected int |
mMaxHeight
|
protected int |
mMaxWidth
|
protected int |
mPreviewFormat
|
Constructor Summary | |
---|---|
CameraBridgeViewBase(Context context,
AttributeSet attrs)
|
Method Summary | |
---|---|
protected void |
AllocateCache()
|
protected Size |
calculateCameraFrameSize(java.util.List<?> supportedSizes,
CameraBridgeViewBase.ListItemAccessor accessor,
int surfaceWidth,
int surfaceHeight)
This helper method can be called by subclasses to select camera preview size. |
protected abstract boolean |
connectCamera(int width,
int height)
This method is invoked shall perform concrete operation to initialize the camera. |
protected void |
deliverAndDrawFrame(Mat frame)
This method shall be called by the subclasses when they have valid object and want it to be delivered to external client (via callback) and then displayed on the screen. |
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 |
protected abstract void |
disconnectCamera()
Disconnects and release the particular camera object being connected to this surface view. |
void |
enableView()
This method is provided for clients, so they can enable the camera connection. |
void |
SetCaptureFormat(int format)
|
void |
setCvCameraViewListener(CameraBridgeViewBase.CvCameraViewListener 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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int mFrameHeight
protected int mFrameWidth
protected int mMaxHeight
protected int mMaxWidth
protected int mPreviewFormat
Constructor Detail |
---|
public CameraBridgeViewBase(Context context, AttributeSet attrs)
Method Detail |
---|
protected void AllocateCache()
protected Size calculateCameraFrameSize(java.util.List<?> supportedSizes, CameraBridgeViewBase.ListItemAccessor accessor, int surfaceWidth, int surfaceHeight)
supportedSizes
- surfaceWidth
- surfaceHeight
-
protected abstract boolean connectCamera(int width, int height)
width
- - the width of this SurfaceViewheight
- - the height of this SurfaceViewprotected void deliverAndDrawFrame(Mat frame)
frame
- - the current frame to be deliveredpublic void disableView()
protected abstract void disconnectCamera()
public void enableView()
public void SetCaptureFormat(int format)
public void setCvCameraViewListener(CameraBridgeViewBase.CvCameraViewListener listener)
public void setMaxFrameSize(int maxWidth, int maxHeight)
maxWidth
- - the maximum width allowed for camera frame.maxHeight
- - the maximum height allowed for camera framepublic void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3)
public void surfaceCreated(SurfaceHolder holder)
public void surfaceDestroyed(SurfaceHolder holder)
|
Official OpenCV 2.4 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |