java `opencv.android.JavaCameraView` 和 `opencv.android.NativeCameraView` 有什么区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16626343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 23:30:38  来源:igfitidea点击:

What is the difference between `opencv.android.JavaCameraView` and `opencv.android.NativeCameraView`

javaandroidopencvcamera

提问by Yoda

Exacly as stated in the subject: What is the difference between opencv.android.JavaCameraViewand opencv.android.NativeCameraView. What are advantages one over the other, the main ones, which gives more options?

正如主题中所述:opencv.android.JavaCameraView和之间有什么区别opencv.android.NativeCameraView。与另一个相比,主要优势是什么,从而提供了更多选择?

回答by 0x6C38

From the OpenCV documentation:

OpenCV 文档

The org.opencv.android.JavaCameraViewclass is implemented inside OpenCV library. It is inherited from CameraBridgeViewBase, that extends SurfaceViewand uses standard Android camera API. Alternatively you can use org.opencv.android.NativeCameraViewclass, that implements the same interface, but uses VideoCaptureclass 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.

org.opencv.android.JavaCameraView班是OpenCV库内部实现。它继承自CameraBridgeViewBase, 扩展SurfaceView并使用标准的 Android 相机 API。或者,您可以使用org.opencv.android.NativeCameraView实现相同接口的VideoCapture类,但使用类作为相机访问后端。opencv:show_fps="true"opencv:camera_id="any"选项启用 FPS 消息并允许使用设备上的任何相机。应用程序首先尝试使用后置摄像头。

Implementation of CvCameraViewListenerinterface 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 CvCameraViewFrameclass that represents frame from camera.

实现CvCameraViewListener界面允许您从帧抓取摄像头后,其在屏幕上呈现前加处理步骤。最重要的功能是onCameraFrame。它是回调函数,在从相机检索帧时调用。回调输入是CvCameraViewFrame表示来自相机的帧的类的对象。

回答by ahmed_khan_89

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)
  • (+1) 更高的帧率

  • (+1) 捕获 RGBA,无需从 android yuv 格式转换。

  • “仅为 armv7 架构编译”不再正确。
  • (-1) 不适用于所有设备 -> 我确认!!这就是我不使用它的原因!!参见错误 2359
  • (-1) 不支持自动对焦,设置增益..(2012 年回答)

I hope this can be helpful !

我希望这会有所帮助!