当用户握持相机还是Android摄像头自动对焦 [英] Android Camera autofocus when user holds camera still

查看:141
本文介绍了当用户握持相机还是Android摄像头自动对焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我敢肯定,你们中的大多数已经使用Android手机之前拍摄的照片。每当用户改变了手机的位置,并保持其稳定状态,相机会自动论点集中。我有一个困难时期我的应用程序复制此。自动对焦()方法被调用,只有当应用程序被启动一次。我一直在寻找一个解决方案,这些过去的3天,在阅读谷歌文档,我偶然发现了传感器的方法调用(当用户倾斜移动向前或向后如)。我可以使用这个API来实现我所需要的,但它听起来太肮脏,太复杂了。我敢肯定有它周围的另一种方式。

I'm sure most of you have used an android phone before and taken a picture. Whenever the user changes the mobile phone's position and holds it steady, the camera focusses automatically. I'm having a hard time replicating this in my app. The autofocus() method is being called only once when the application is being launched. I have been searching for a solution these past 3 days and while reading the google documentation I stumbled upon the sensor method calls (such as when the user tilts the mobile forwards or backwards). I could use this API to achieve what I need but it sounds too dirty and too complicated. I'm sure there's another way around it.

在互联网上的所有实施例,我已发现,只有当用户presses屏幕或按钮对焦。我也有通过SO几个问题去希望找到我所期待的,但我没有成功。我所看到的<一个href="http://stackoverflow.com/questions/7156403/is-there-an-efficient-way-to-do-continuous-auto-focus">this的问题,该字符串是不是与我的手机兼容。出于某种原因,只聚焦模式,我可以使用固定和经销商。

All examples on the internet which I have found only focus when the user presses the screen or a button. I have also gone through several questions on SO to hopefully find what I am looking for but I was unsuccessful. I have seen this question and that String is not compatible with my phone. For some reason the only focussing modes which I can use is fixed and auto.

我希望这里有人会脱落一些关于这个问题的光,因为我很茫然。

I was hoping someone here would shed some light on the subject because I am at a loss.

三江源非常多的时间。

推荐答案

camera.autoFocus(回调)是一次性的功能。您将需要调用它在一个循环中有它不断地自动对焦。 preferably你将不得不通过加速计和罗盘一个运动检测到检测时相机移动。

Yes, camera.autoFocus(callback) is a one-time function. You will need to call it in a loop to have it autofocus continuously. Preferably you would have a motion detection via accelerometer or compass to detect when camera is moved.

这篇关于当用户握持相机还是Android摄像头自动对焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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