相机preVIEW宽高比总是需要16x9的surfaceview

相机preVIEW宽高比总是需要16x9的surfaceview

本文介绍了的Nexus 4相机preVIEW宽高比总是需要16x9的surfaceview?为什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设备的Nexus 4Android的版本:4.2.2

Device Nexus 4Android ver: 4.2.2

希望其他人发现了这一点,并解释如何解决它....

Hoping someone else has found this and can explain how to resolve it....

的Nexus 4支持以下preVIEW尺寸: -

Nexus 4 supports the following preview sizes: -

W:1280 H:720 Ratio: 1.777777
W:800 H:480 Ratio: 1.6666666
W:768 H:432 Ratio: 1.7777778
W:720 H:480 Ratio: 1.5
W:640 H:480 Ratio: 1.3333334
W:576 H:432 Ratio: 1.3333334
W:480 H:320 Ratio: 1.5
W:384 H:288 Ratio: 1.3333334
W:352 H:288 Ratio: 1.2222222
W:320 H:240 Ratio: 1.3333334
W:240 H:160 Ratio: 1.5
W:176 H:144 Ratio: 1.2222222

myCamera.set previewSize()设置他们,当我打电话myCamera.get previewSize()我得到正确的一个,我设置的,但....如果我把我的面欣赏到尺寸相同,我的相机preVIEW然后我得到一个扩张的图象。例如,

myCamera.setPreviewSize() sets them, and when I call myCamera.getPreviewSize() I get the correct one that I set, BUT.... If I set my surface view to the same size as my camera preview then I get a stretched image. e.g.

setPreviewSize(640,480)
getPreviewSize -> I get 640,480
Surface view (640,480) -> Stretched image

只有当我把我的面,以16:9(1.77777)做我得到一个完美的形象。

Only if I set my Surface view to 16x9 (1.77777) do I get a perfect image.

Surface view (1280,720) -> Perfect image

这是我有这个问题的唯一设备。请能有人告知,如果有一个摄像头的设置,我失踪了全屏模式或东西是从工作停止这个。

This is the only device that I have this issue with. Please can someone advise if there is a camera setting I am missing for full screen mode or something that is stopping this from working.

在我漫长的寻找,我发现1等也涉及到这个问题的帖子,但没有回答,只是有点多的证据显示我的问题PictureCallback不叫除非使用supportedsizes [0]

In my long search I found 1 other post which relates also to this issue, but not an answer, just a bit more evidence of my problemPictureCallback not called unless using supportedsizes[0]

感谢

推荐答案

在了Nexus 4,有一个不幸的问题,即preVIEW宽高比和静止图像纵横比是绑在一起,即使你永远不要图片。如果它们不匹配,则两个中的一个被扭曲(通常preVIEW,因为它是较低的分辨率)。

On the Nexus 4, there's an unfortunate issue where the preview aspect ratio and the still picture aspect ratio are tied together, even if you never take a picture. If they don't match, one of the two gets distorted (typically preview, since it is the lower resolution).

。例如,640×480 preVIEW一个完整的800万像素图像尺寸(3264 x 2448)的N4应该不会造成绵延preVIEW。

If you want to use a 4:3 preview, configure the still picture size to be 4:3 as well, before starting preview. For example, 640x480 preview with a full 8MP picture size (3264 x 2448) on N4 should cause no stretching for preview.

使用Camera.Parameters.setPictureSize选择图片大小;可用尺寸的列表可以从Camera.Parameters.getSupportedPictureSizes.

Use Camera.Parameters.setPictureSize to select the picture size; the list of available sizes can be read from Camera.Parameters.getSupportedPictureSizes.

这篇关于的Nexus 4相机preVIEW宽高比总是需要16x9的surfaceview?为什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 07:16