[英]How to disable/modify AutoFocus and AutoWhiteBalance on Android Camera using OpenCV
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. 我正在使用Android + Opencv(新的opencv),我正在使用实时对象检测(该对象保持非常接近Android设备相机),我注意到Android相机的autoFocus一直在修改我的帧(种类) '放大'和'缩小'效果)让我更难跟踪对象。
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. 我需要关闭“AUTO FOCUS”,因为在我的情况下,我的图像输入越模糊越好,我也需要关闭AutoWhiteBalance,或者设置为不同的值。
I would like to know how to do it through my OpenCV CameraBridgeViewBase so I could modify the camera's Focus/WhiteBalance settings. 我想通过我的OpenCV CameraBridgeViewBase知道如何做到这一点,所以我可以修改相机的Focus / WhiteBalance设置。
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. 在这里,Stack Overflow将是一个很好的地方,可以找到一个与之合作过的人并找到克服这些问题的好方法。
create your own subclass of javacameraview
public class MyJavaCameraView extends JavaCameraView {
where you can have access to mCamera
; 创建自己的
javacameraview
public class MyJavaCameraView extends JavaCameraView {
的子public class MyJavaCameraView extends JavaCameraView {
您可以访问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);
and use this new class as part of the main activity 并使用这个新类作为主要活动的一部分
//force java camera
mOpenCvCameraView = (MyJavaCameraView) findViewById(R.id.activity_surface_view);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
mOpenCvCameraView.setCvCameraViewListener(this);
mOpenCvCameraView.enableView();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.