Android SurfaceView预览版太暗

编程入门 行业动态 更新时间:2024-10-25 08:15:59
本文介绍了Android SurfaceView预览版太暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发使用Surfaceview的应用程序.我可以拍照,一切都很好.

I'm developing an App that uses Surfaceview. I can take pictures and everything's fine.

我的问题是:预览图像太暗.我尝试更改相机的SceneMode,但没有任何效果(我尝试了AUTO,NIGHT和NIGHT_PORTRAIT).

My problem is: the image of the preview is too dark. I try to change the SceneMode of the camera, but nothing is working (I've tried AUTO, NIGHT and NIGHT_PORTRAIT).

以下是使用我的应用拍摄的照片之间的区别:

Here is the difference between pictures taken with my app:

和Android Camera App(本机):

and the Android Camera App (native):

这是我的代码(凸轮上使用的参数):

Here's my code (the params used on cam):

c = Camera.open(0); Camera.Parameters params = c.getParameters(); params.setSceneMode(Camera.Parameters.SCENE_MODE_NIGHT); params.setAutoExposureLock(true); params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); if (params.getMaxNumMeteringAreas() > 0){ // check that metering areas are supported List<Camera.Area> meteringAreas = new ArrayList<>(); Rect areaRect1 = new Rect(-100, -100, 100, 100); // specify an area in center of image meteringAreas.add(new Camera.Area(areaRect1, 600)); // set weight to 60% Rect areaRect2 = new Rect(800, -1000, 1000, -800); // specify an area in upper right of image meteringAreas.add(new Camera.Area(areaRect2, 400)); // set weight to 40% params.setMeteringAreas(meteringAreas); } c.setParameters(params);

有人可以帮助我吗?

谢谢!

推荐答案

  • 不要锁定自动曝光;如果这样做的话,相机将保持锁定状态下的任何设置,这可能太暗了

  • Don't lock auto-exposure; if you do, the camera is stuck with whatever settings it had when you locked it, which may be too dark

    确保预览FPS范围允许相机减慢帧频以增加曝光.最好选择10-30 fps之类的范围;查看支持的fps范围.

    Make sure the preview FPS range allows the camera to slow down frame rate in order to increase exposure. Best to select something like 10-30 fps as the range; see what the supported fps ranges are.

    在完成其余工作之前,请避免设置测光区域.

    Avoid setting the metering area until you have the rest of this working.

    Android摄像头应用程序绝对未使用NIGHT场景模式,因此除非您知道它在使用该应用程序的设备上执行了某些有用的操作,否则我将避免使用它.它不是跨设备标准化的.

    The Android camera app is definitely not using NIGHT scene mode, so I would avoid it unless you know it does something useful on the device you're using your app on; it's not standardized across devices.

  • 更多推荐

    Android SurfaceView预览版太暗

    本文发布于:2023-11-17 06:48:14,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1609202.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:预览版   Android   SurfaceView

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!