三星Galaxy S4,图像获取,而从相机拍摄损坏 [英] Samsung Galaxy S4 , Image gets corrupted while taking from camera

查看:117
本文介绍了三星Galaxy S4,图像获取,而从相机拍摄损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用摄像头在我的应用程序。相机正在完善高达上三星S3甚至所有设备。图像从所有其它设备是正确的。

I'm using camera on my app. Camera is working perfect on all devices upto Samsung S3 even. Image is correct from all other devices.

同时服用图像从S4,图像被损坏,图像会保存在一些水平线条。

While taking image from S4 , image gets corrupted and image gets saved with some lines in horizontal.

我试图改变分辨率和一切,但仍然问题是存在的。

I tried changing resolution and everything but still issue is there .

任何帮助

Any help

推荐答案

我一直在拉我的头发了这一点,我想我找到了问题,至少是关于我的应用程序 - 它有什么做的的preVIEW图像相对于所捕获的图像的高宽比。

I've been pulling my hair out over this and I think I found the issue, at least with regards to my app - it's got something to do with the aspect ratio of the preview image versus the captured image.

在我的情况,我的code的嗅出根据屏幕的高宽比理想的preVIEW大小。 S4的是一个1080的电话,所以preVIEW形象是1920×1080,这是一款16:9的纵横比。但我的code是很难coded到捕捉1600×1200的图像,这是4:3,因为这是我所需要的。但1600x1200的不是有效的尺寸S4支持之一

In my case, my code was sniffing out the ideal preview size based on the aspect ratio of the screen. The S4 is a 1080p phone, so the preview image was 1920x1080, which is a 16:9 aspect ratio. But my code was hardcoded to capturing a 1600x1200 image, which is 4:3, because that's all I needed. But 1600x1200 is not one of the valid sizes the S4 supports.

如果不设置的大小,S4捕获4128x3096,这是最大的尺寸,并且为4:3,但线条仍出现了。有一次,我告诉相机捕捉到了16:9的照片,该行就走开了。在你的情况,你可能需要调整preVIEW的纵横比。

Without setting the size, the S4 captured 4128x3096, which is the maximum size, and is 4:3, but the lines still appeared. Once I told the camera to capture a 16:9 photo, the lines went away. In your case, you might want to adjust the preview's aspect ratio.

下面是一些code,可以告诉你可用的尺寸。

Here's some code which can tell you the available sizes.

    List<Camera.Size> previewSizes = p.getSupportedPreviewSizes();

    int i = 1;

    for (Size previewSize : previewSizes) {
        Log.v("DebugCamera", "previewSize " + i++ + " width: " + previewSize.width + " height: " + previewSize.height);
    }

    List<Camera.Size> pictureSizes = p.getSupportedPictureSizes();

    i = 1;

    for (Size pictureSize : pictureSizes) {
        Log.v("DebugCamera", "pictureSize " + i++ + " width: " + pictureSize.width + " height: " + pictureSize.height);
    }

这篇关于三星Galaxy S4,图像获取,而从相机拍摄损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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