如何使用OpenCV在Android相机上禁用/修改AutoFocus和AutoWhiteBalance [英] How to disable/modify AutoFocus and AutoWhiteBalance on Android Camera using OpenCV
问题描述
我需要将AUTO FOCUS 关闭,因为在我的情况下,我输入的图像越模糊,效果越好,同时我也需要关闭AutoWhiteBalance,或者设置为不同的值。
<我想知道如何通过我的OpenCV CameraBridgeViewBase,所以我可以修改相机的焦点/白平衡设置。
我试图找到一种方法解决这个问题,我注意到很多人面临同样的问题。
在这里,在堆栈溢出,将是一个伟大的地方,找到一个谁曾经一起工作,找到了一个很好的方法来克服这些问题。 $ b
创建您自己的子类 并将这个新类用作主要活动的一部分 I'm using Android + Opencv(new to opencv) and I'm currently working with real time object detection (the object stays really close to the android device Camera) , and I noticed that the Android camera's autoFocus keeps modifying my frames (kind of 'zoom in' and 'zoom out' effect) which make it harder for me to keep tracking the object. I need to turn the "AUTO FOCUS" off because in my case the more blurred image input I have, the better, and I also need to turn the AutoWhiteBalance off as well, or maybe set to a different value. I would like to know how to do it through my OpenCV CameraBridgeViewBase so I could modify the camera's Focus/WhiteBalance settings. I've trying to find a way to solve it, and I noticed that many people face the same problems. Here, at Stack Overflow, would be a great place to find someone who have worked with that and found a good way to overcome these problems. create your own subclass of and use this new class as part of the main activity
这篇关于如何使用OpenCV在Android相机上禁用/修改AutoFocus和AutoWhiteBalance的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
public class MyJavaCameraView扩展JavaCameraView {
,您可以访问 mCamera
;
添加任何相机访问使用你感兴趣的方法
例如
$ $ p $ $ $
public void setFlashMode(boolean flashLightON){
Camera camera = mCamera;
if(camera!= null){
Camera.Parameters params = camera.getParameters();
params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
camera.setParameters(params);
//强制java相机
mOpenCvCameraView =(MyJavaCameraView)findViewById(R.id.activity_surface_view);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
mOpenCvCameraView.setCvCameraViewListener(this);
mOpenCvCameraView.enableView();
javacameraview
public class MyJavaCameraView extends JavaCameraView {
where you can have access to mCamera
;
add whatever camera access using method you are interested in
for example// Setup the camera
public void setFlashMode(boolean flashLightON) {
Camera camera = mCamera;
if (camera != null) {
Camera.Parameters params = camera.getParameters();
params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
camera.setParameters(params);
//force java camera
mOpenCvCameraView = (MyJavaCameraView) findViewById(R.id.activity_surface_view);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
mOpenCvCameraView.setCvCameraViewListener(this);
mOpenCvCameraView.enableView();