Android的卡马拉参数getZoomRatio()值未如预期 [英] Android camara parameters getZoomRatio() values not as expected

查看:943
本文介绍了Android的卡马拉参数getZoomRatio()值未如预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我得到的变焦比,与列表:)parameters.getZoomRatios(,返回值是100114 ...... 200(corresponeding 1倍1.14x ...... 2.0倍变焦),但在相机preVIEW在200(2倍变焦),画面出现放大更多然后2倍。在样本图像,显示在1倍一根6CM FOV和2.5厘米在2倍变焦......我在2倍预期3.0厘米。


有另一种方式,我应该是间preting这些价值?......任何人都看到了吗?或者是该设备/特定版本,或者我应该通过一些常数或其他值(焦距)被乘以?我试图符合我的摄影机视图渲染视图我的应用程序,当我放大,这是搞乱匹配。

code是标准的位置:

 公共无效setZoom(INT pZoom)
{
    最后Camera.Parameters P = this.mCamera.getParameters();
    如果(p.isZoomSupported())
    {
        p.setZoom(pZoom);
        this.mCamera.setParameters(P);    }
}    公众诠释getZoom(android.hardware.Camera摄像头)
    {
        INT变焦= 100;        最终的参数P = camera.getParameters();
        如果(p.isZoomSupported())
        {
            最终名单<整数GT; zoomRatios = p.getZoomRatios();
            最终诠释zoomIndex = p.getZoom();
            如果(zoomIndex&下; zoomRatios.size())
            {
                变焦= zoomRatios.get(zoomIndex);
            }
            //Log.d(\"zoom\",\"ix:+ zoomIndex +Z+变焦);        }
        返回变焦;
    }


解决方案

试图修复为不同型号的手机同等缩放级别,当我还偶然发现了这个问题。该比率似乎很有前途,但我放弃了使用它们,因为它太不一致。

作为亚瑟王,我也意识到值应该是等距离的,只有最后一个值有时不反映实际的缩放因子。下面是我的例如三星S4的比例:
[100,102,104,107,109,112,114,117,120,123,125,128,131,135,138,141,144,148,151,155,158,162,166,170,174 ,178,182,186,190,195,200]
这是误导,因为手机有一个4倍变焦,但名单不能与400结束!

我看不出逻辑,所以最后我就放弃了。
我会非常有兴趣,如果有人可以提供解释。
干杯

if i get a list of zoom ratios with: parameters.getZoomRatios(), values returned are 100,114...200 (corresponeding to 1x 1.14x ...2.0x zoom), but in the camera preview at 200 (2x zoom), the picture appears zoomed much more then 2x. in sample images, show a 6cm fov at 1x and 2.5cm at 2x zoom... I was expecting 3.0cm at 2x.

Is there another way i should be interpreting these values?...Anyone else see this? or is this device/version specific, or should i be multiplying by some constant or other value (focal length)? i'm trying to match my camera view to rendered view for my app, and as i zoom, this is messing up the matching.

code is standard here:

public void setZoom(int pZoom)
{
    final Camera.Parameters p = this.mCamera.getParameters();
    if (p.isZoomSupported())
    {
        p.setZoom(pZoom);
        this.mCamera.setParameters(p);

    }


}

    public int getZoom( android.hardware.Camera camera)
    {
        int zoom = 100;

        final Parameters p = camera.getParameters();
        if (p.isZoomSupported())
        {
            final List<Integer> zoomRatios = p.getZoomRatios();
            final int zoomIndex = p.getZoom();
            if (zoomIndex < zoomRatios.size())
            {
                zoom = zoomRatios.get(zoomIndex);
            }   
            //Log.d("zoom","ix:" + zoomIndex + " z:"+zoom);         

        }               
        return zoom;
    }   

解决方案

I also stumbled upon this issue when trying to fix an equivalent zoom level for different phone models. The ratios seemed promising but I gave up using them because it was too inconsistent.

As King Arthur, I also realised the values should have been equidistant, only the last value sometimes didn't reflect the actual zoom factor. Here's for example the ratios of my Samsung S4: [100, 102, 104, 107, 109, 112, 114, 117, 120, 123, 125, 128, 131, 135, 138, 141, 144, 148, 151, 155, 158, 162, 166, 170, 174, 178, 182, 186, 190, 195, 200] It is misguiding because the phone has a 4x zoom but the list doesn't end with 400!

I don't see the logic, so in the end I just gave up. I'd be very interested if someone can provide an explanation. Cheers

这篇关于Android的卡马拉参数getZoomRatio()值未如预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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