1

下面是我使用 flaten() 打印的 Android 相机参数。我使用 Surface 视图并使用 camera.open() 手动打开我的相机。我使用 setParameter() 设置 camera.paramter。

-max=30;zoom=0;taking-picture-zoom=0;zoom-supported=true;sharpness-min=0;sharpness=10;contrast=5;whitebalance=auto;jpeg-quality=100;preview-format-values=yuv420sp;jpeg-thumbnail-quality=75;preview-format=yuv420sp;preview-size=576x432;focal-length=4.92;iso=auto;meter-mode=meter-center;front-camera-mode=mirror;flash-mode-values=off,auto,on,torch;preview-frame-rate-values=15;preview-frame-rate=15;focus-mode-values=auto,infinity;jpeg-thumbnail-width=768;jpeg-thumbnail-size-values=768x576,640x480,512x384,0x0;zoom-ratios=100,114,131,151,174,200;saturation-def=5;preview-size-values=1280x720,800x480,768x432,720x480,640x480,576x432,480x320,400x240,384x288,352x288,320x240,272x272,240x240,240x160,176x144;smart-contrast=off;picture-size-values=3264x2448,3264x1952,2592x1952,2592x1552,2048x1536,2048x1216,1600x1200,1280x960,1280x768,1024x768,640x480,640x384,512x384,400x400,272x272;contrast-min=0;min-exposure-compensation=-4;brightness-min=0;antibanding=auto;taking-picture-zoom-min=0;saturation-min=1;contrast-max=10;vertical-view-angle=38;taking-picture-zoom-max=30;contrast-def=5;brightness-max=6;horizontal-view-angle=49.5;brightness=3;jpeg-thumbnail-height=576;cam-mode=0;focus-mode=auto;sharpness-def=10;front-camera-mode-values=mirror,reverse;picture-format-values=jpeg;saturation-max=10;max-exposure-compensation=4;exposure-compensation=0;exposure-compensation-step=0.5;flash-mode=off;effect-values=none,mono,negative,solarize,sepia,posterize,aqua;meter-mode-values=meter-average,meter-center,meter-spot;picture-size=1024x768;max-zoom=5;effect=none;saturation=5;whitebalance-values=auto,incandescent,fluorescent,daylight,cloudy-daylight;picture-format=jpeg;brightness-def=3;iso-values=auto,deblur,100,200,400,800,1250;antibanding-values=off,50hz,60hz,auto**

**

  • 我的相机图像在所有设备中都不一致。某些 Droid 和旧手机存在图像模糊和图像缩小问题。是否有任何需要微调的特定参数?

**

4

1 回答 1

5

这与不同手机的不同预览尺寸有关。

我在一个相机预览相关的android项目中使用了以下方法:

在surfaceCreated方法里面:

Camera camera = Camera.open(CameraInfo.CAMERA_FACING_BACK);
final Camera.Parameters params = camera.getParameters();
final Size size = getOptimalSize();
params.setPreviewSize(size.width, size.height);
camera.setParameters(params);

在同一活动中:

private Size getOptimalSize() {
    Camera.Size result = null;
    final Camera.Parameters parameters = camera.getParameters();
    Log.i(Preview.class.getSimpleName(), "window width: " + getWidth() + ", height: " + getHeight());
    for (final Camera.Size size : parameters.getSupportedPreviewSizes()) {
        if (size.width <= getWidth() * PREVIEW_SIZE_FACTOR && size.height <= getHeight() * PREVIEW_SIZE_FACTOR) {
            if (result == null) {
                result = size;
            } else {
                final int resultArea = result.width * result.height;
                final int newArea = size.width * size.height;

                if (newArea > resultArea) {
                    result = size;
                }
            }
        }
    }
    if (result == null) {
        result = parameters.getSupportedPreviewSizes().get(0);
    }
    Log.i(Preview.class.getSimpleName(), "Using PreviewSize: " + result.width + " x " + result.height);
    return result;
}

当然我应该补充一点,我们使用的因素是: PREVIEW_SIZE_FACTOR = 1.30;

于 2013-08-09T19:14:40.427 回答