Android:用“连续"录制视频自动对焦 [英] Android: record video with "continuous" auto-focus

查看:25
本文介绍了Android:用“连续"录制视频自动对焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事视频录制工作;除了要求持续专注之外,一切正常.这就是我所做的(在surfaceCreated 和surfaceChanged 中都尝试过,但都没有成功):

I work on video recording; everything works except for requesting continuous focus. This is what I do (tried both in surfaceCreated and surfaceChanged with no success):

camera = Camera.open();
camera.setPreviewDisplay(holder);

Parameters parameters = camera.getParameters();

那我也可以

parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);

parameters.set("focus-mode", "continuous-video");

两者都应该做同样的事情;然后我用

both should do the same thing; then I set parameters with

camera.setParameters(parameters);

最后一行总是崩溃!那么我错过了什么吗?

This last line always crashes! So do I miss something?

顺便说一句,我在 Desire HD、Galaxy S、Galaxy Tab 7 和 10.1 等相当新的设备上进行了测试,这些设备必须支持连续自动对焦;至少他们的内置相机应用程序支持它.

By the way, I test on rather new devices like Desire HD, Galaxy S, Galaxy Tab 7 and 10.1, which must have support for continuous auto-focus; at least their built-in camera apps support it.

推荐答案

好的,我有办法解决这个问题:我可以通过调用 Camera#autoFocus(...) 手动对焦相机.

Ok, I have sort of solution to this problem: I was able to manually focus camera calling Camera#autoFocus(...).

这仍然存在严重问题.首先,在某些三星设备上无法在拍摄视频时调用自动对焦.此外,在视频录制期间强制用户手动对焦也不是一个好主意.

This still has serious issues. First, calling autofocus while shooting video is not working on some Samsung devices. Also it's not a good idea to force your users to manually focus the camera during video recording.

因此,如果您能够在录制时正常专注于您的视频 - 您的建议将非常有帮助.

So if you were able to normally focus your videos while recording - your advice would be very helpful.

这篇关于Android:用“连续"录制视频自动对焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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