本文介绍了问题与三星Galaxy SIII - Camera.onPictureTaken()再次隔行扫描图像,而不是正确的捕捉图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有利用后照相机拍摄物品图像的应用程序。到目前为止,我们已经测试过的所有设备都工作正常的捕捉图像,它应该是长期,直到三星Galaxy SIII(S3)。

We have an application that utilizes the rear 'Camera' to capture item image. So far all devices that we have tested are all working correctly in term of capturing image as it should be, until Samsung Galaxy SIII (S3).

在三星Galaxy SIII而已,我们观察到Camera.onPictureTaken()的返回一个原始图像出现隔行扫描,而不是正确的捕捉图像。调试每个摄像机的参数设置,确定下列参数设定部造成问题。如果我们没有明确setPictureSize()的参数,然后将其按预期工作:

On Samsung Galaxy SIII only, we are observing that Camera.onPictureTaken() is returning an raw image appears to interlaced instead of proper capture image. Debugging each of camera parameter setting, determine that the following parameter setter is causing the issue. If we don't explicitly setPictureSize() on parameter, then it is working as expected:

parameters.setPictureSize(targetPictureSize);  

在默认情况下parameters.getPictureSize()的返回为[W,H] = [3264,2448]

By default parameters.getPictureSize() return as [w,h]=[3264, 2448]

的'targetPictureSize'是对从下方接近的匹配尺寸返回确定的碱基,在此情况下,我们已经使用的[w中,h] = [1600,1200]大小的'targetPictureSize'

The 'targetPictureSize' is determined base on closest matching Size return from below, in this case, we have used the [w,h]=[1600, 1200] size as the 'targetPictureSize'

camera.getParameters().getSupportedPictureSizes();

任何人都知道的原因和解决方法?

Anyone know the reason and a workaround?

推荐答案

出现此问题,当你调用发生 camera.setParameters 用不同的pictureSize比什么配置previously(或默认值),而preVIEW是活动的。解决的办法是启动preVIEW或停止preVIEW,设定参数,然后重新启动preVIEW之前醚设置图片大小。

This issue appears to happen when you call camera.setParameters with a different pictureSize than what was configured previously (or the default value), while the preview is active. The solution is to ether set the picture size before starting the preview or stopping the preview, setting the parameters, and then restarting the preview.

parameters.setPictureSize(1600, 1200);
...
camera.stopPreview();
camera.setParameters(parameters);
camera.startPreview();

技术说明:

交织的原因似乎是,将图像从被捕获以默认的分辨率(3264X2448)相机返回,但被标记为您提供setPictureSize中指定的分辨率。其结果是,在显示这样的图像时,被显示的像素从拍摄图像中的每一行作为(默认分辨率/指定的分辨率)行像素。随着1600×1200的图片大小,这将导致图像中泛起隔行扫描,而在其他分辨率(例如640×480)的图像将会出现完全损坏。

The cause of the interlacing appears to be that the image returned from the camera is captured at the default resolution (3264x2448), but is marked as the resolution you specified with setPictureSize. As a result, when such image is being displayed, every row of pixels from the captured image is being displayed as (default resolution / specified resolution) rows of pixels. With picture size of 1600x1200 this will result in the image appearing interlaced, while at other resolutions (ex. 640x480) the image will appear completely corrupted.

这篇关于问题与三星Galaxy SIII - Camera.onPictureTaken()再次隔行扫描图像,而不是正确的捕捉图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 08:28