Camera.Parameters.setRecordingHint和长宽比 [英] Camera.Parameters.setRecordingHint and aspect ratio
问题描述
我已经发现了一些奇怪的行为围绕<一个href=\"http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRecordingHint%28boolean%29\"相对=nofollow> Camera.Parameters.setRecordingHint ,我想更好地了解。
I've found some odd behavior around Camera.Parameters.setRecordingHint that I'd like to understand better.
如果我将它设置为真正
中,preVIEW图像的大小可以来自我传回不同于<一个href=\"http://developer.android.com/reference/android/hardware/Camera.Parameters.html#set$p$pviewSize%28int,%20int%29\"相对=nofollow>集previewSize 。这取决于什么大小我设置一些中场休息的纵横比工作,有些则没有。
If I set it to true
, the size of the preview image can come back different from what I pass to setPreviewSize. It depends on what size I set it to-- some aspect ratios work and some don't.
请参阅below-- 集previewSize
已被设置为640x480两个截图,但是你要setRecordingHint 真正
,另一个假
。我有code产生在GitHub上这个效果。
See the screenshots below-- setPreviewSize
has been set to 640x480 for both, but one has setRecordingHint to true
and the other to false
. I have the code that produces this effect on GitHub.
这是预期的行为?对于<一的文档href=\"http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRecordingHint%28boolean%29\"相对=nofollow> setRecordingHint 不表明这样的事。
Is this expected behavior? The docs for setRecordingHint don't indicate anything like this.
推荐答案
您需要视频尺寸
参数设置为正确的值。我有同样的问题 - preVIEW大小是 640×480
,并同时使用preVIEW出现捉襟见肘 setRecordingHint(真)
。然后我用 getParameters()。压扁()
来打印出我的相机
设备设置的所有参数。我的视频尺寸
参数实际上是设置为 1920×1080
导致不正确的纵横比。可以使用 params.set(视频大小,宽x高),改变这个参数
。只有这样,宽高比是否正确。
You need to set video-size
parameter to the correct value. I had the same problem - preview size was 640x480
and the preview appeared stretched while using setRecordingHint(true)
. I then used getParameters().flatten()
to print out all parameters set for my Camera
device. My video-size
parameter was actually set to 1920x1080
causing the incorrect aspect ratio. You can change this parameter using params.set("video-size", "WxH")
. Only then is the aspect ratio correct.
这篇关于Camera.Parameters.setRecordingHint和长宽比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!