Exacly as stated in the subject: What is the difference between opencv.android.JavaCameraView
and opencv.android.NativeCameraView
. What are advantages one over the other, the main ones, which gives more options?
What is the difference between `opencv.android.JavaCameraView` and `opencv.android.NativeCameraView`
2 Answers
From the OpenCV documentation:
The org.opencv.android.JavaCameraView
class is implemented inside OpenCV library. It is inherited from CameraBridgeViewBase
, that extends SurfaceView
and uses standard Android camera API. Alternatively you can use org.opencv.android.NativeCameraView
class, that implements the same interface, but uses VideoCapture
class as camera access back-end. opencv:show_fps="true"
and opencv:camera_id="any"
options enable FPS message and allow to use any camera on device. Application tries to use back camera first.
Implementation of CvCameraViewListener
interface allows you to add processing steps after frame grabbing from camera and before its rendering on screen. The most important function is onCameraFrame
. It is callback function and it is called on retrieving frame from camera. The callback input is object of CvCameraViewFrame
class that represents frame from camera.

- 6,796
- 4
- 35
- 47
-
It is still unclear which one is better for the image processing like human detection.. gettin array of pixels etc. – Yoda May 18 '13 at 16:21
-
2Can someone expand on the difference between the Android Camera API and the OpenCV VideoCapture class from a usage point of view? Performance, Features, Stability, Is the VideoCapture class only accessible from c/c++? – Zachary Moshansky Nov 22 '13 at 20:31
-
3As this is an old post, I'll post only a comment. It's recommended to use Java implementation whenever it's possible. All the JNI calls cost a lot in terms of performance, the same goes for mmaped memory usage. This applies not only to the camera usage. – Max Malysh Nov 24 '14 at 23:16
I just took this answer from here (Which is a bit old answer) and added what I experienced:
native camera:
(+1) higher framerate
(+1) capture RGBA, no need to convert from android yuv format.
- "compiled only for armv7 architecture" not true anymore.
- (-1) not work on all devices -> I confirm !! This is why I don't use it !! see bug 2359.
- (-1) not support autofocus, setting gain.. (answered in 2012)
I hope this can be helpful !

- 2,755
- 26
- 49