简体   繁体   English

ARCore - 如何将相机焦点更改为“自动对焦”?

[英]ARCore – How do I change camera focus to “Auto Focus”?

I am trying to implement the Augmented Images example but for an object that is really close to the camera. 我正在尝试实现增强图像示例,但是对于非常接近相机的对象。 Thus, I need the focus to be changed as the fixed focus makes the foreground object completely blurred. 因此,我需要改变焦点,因为固定焦点使前景物体完全模糊。

I am using Java in Android Studio along with Sceneform ARCore 1.6 for this project and it would really help if some code were posted along with a solution so I can implement this. 我在Android Studio中使用Java以及Sceneform ARCore 1.6用于此项目,如果一些代码与解决方案一起发布,那么我可以实现这一点。

I have tried the following, but get an error saying 'Cannot resolve symbol 'context'' 我尝试了以下内容,但收到错误消息“无法解析符号”上下文''

Session session = new Session(context);
Config config = new Config(session);

config.setFocusMode(Config.FocusMode.AUTO);
session.configure(config);

Use the following code for proper configuration: 使用以下代码进行正确配置:

Session session = new Session(context);
Config configuration = new Config(session);

if (enableAutoFocus) {
    configuration.setFocusMode(Config.FocusMode.AUTO);
} else {
    configuration.setFocusMode(Config.FocusMode.FIXED);
}

session.configure(configuration);

But at the time of writing this post, Google confirms that autofocus isn't working in ARCore 1.8 for some LG models. 但在撰写本文时,Google 确认自动对焦在某些LG型号的ARCore 1.8中无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM