如何在Android的Camera2 API中设置无限远焦点? [英] How to set infinity focus in camera2 api, android?

查看:340
本文介绍了如何在Android的Camera2 API中设置无限远焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用外部鱼眼镜头将自定义相机的焦距设置为无穷远,这是我到目前为止所做的:

I wanna set my custom camera focus distance to infinity while using external fisheye lens, This is what I have done so far:

builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_OFF);
builder.set(CaptureRequest.LENS_FOCUS_DISTANCE, 0.0f);

但是结果太模糊了.

我正在使用Samsung S6和Nexus 5. 外部镜头的广角为170度.

I am using Samsung S6 and Nexus 5. External lens's wide angle is 170 degree.

任何人都可以帮忙吗?

推荐答案

如果您只是在谈论使用内置摄像头的镜头实现鱼眼镜头,那么您应该使用的最低值是:

If you are just talking about using the built-in camera's lens to achieve fisheye, then the lowest value you should use is:

float minFocalDist = cameraCharacteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);

如果您使用外接镜头,那么我认为正确的方法实际上是在相机上使用自动对焦,因为这应该对焦于鱼眼镜头的焦距...我认为.因此,外部镜头可保护鱼眼镜头,而内部镜头可实现自动对焦.但是,如果这不起作用,那么将焦距设置为超焦距时,您会看到什么.该距离可能不是最佳距离,但在大多数情况下应该可以使用...

If you are using an external lens, then I believe that the correct approach is actually to use autofocus on the camera, since that should focus to the focal length of the fish eye lens... I think. So the external lens is taking care of fisheye and the internal is taking care of autofocus. However, if this doesn't work, then see what you get when you set the focal length to the hyperfocal distance. That distance might not be optimal, but it should work in most cases...

float hyperFocalDist = cameraCharacteristics.get(CameraCharacteristics.LENS_INFO_HYPERFOCAL_DISTANCE);

这篇关于如何在Android的Camera2 API中设置无限远焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆