简体   繁体   English

如何使用 Camera2 API android 提高捕获的图像分辨率?

[英]How to improve captured image resolution with Camera2 API android?

I am using this projectandroid-camera2-secret-picture-taker to capture image without open camera view, but the captured images is very bad like this我正在使用这个项目android-camera2-secret-picture-taker在没有打开相机视图的情况下捕获图像,但是捕获的图像非常糟糕,像这样在此处输入图片说明

any help to make this better?任何帮助使这更好?
thanks谢谢
[Edit] [编辑]
I tried other phones and it works fine, I take this bad images on Huawei Y6II only and I don't know why?我试过其他手机,效果很好,我只在华为 Y6II 上拍了这张糟糕的照片,我不知道为什么? the phone camera is 13 mpx and works fine with native camera app.手机摄像头为 13 mpx,适用于本机摄像头应用程序。

Did you issue only a single capture request to the camera device?您是否只向相机设备发出了一个捕获请求? (No free-running preview or such). (没有自由运行的预览等)。

Generally, the auto-exposure, focus, and white-balance routines take a second or so of streaming before they stabilize to good values.通常,自动曝光、对焦和白平衡例程在稳定到良好值之前需要一秒钟左右的时间流。

Even if you don't want a preview on screen, you need to request 10-30 frames of data from the camera to start before you save a final image.即使您不想在屏幕上进行预览,您也需要在保存最终图像之前从相机请求 10-30 帧数据才能开始。 Or to be more robust, set a repeating request targeting some low-resolution SurfaceTexture, and wait until the CaptureResult CONTROL_AE_STATE / AWB_STATE fields reach CONVERGED, and the AF_STATE field is what you want as well (depends on what AF mode you're using).或者为了更健壮,设置一个针对某些低分辨率 SurfaceTexture 的重复请求,并等待 CaptureResult CONTROL_AE_STATE / AWB_STATE 字段达到 CONVERGED,并且 AF_STATE 字段也是您想要的(取决于您使用的 AF 模式) . Then capture your image.然后捕获您的图像。

This is a wildly blind guess, but hey, worth a try.这是一个非常盲目的猜测,但是嘿,值得一试。

If you used some code snippet from the web which suggests to get a list of supported image sizes and just pick the first one - well this has backfired for me on Huawei devices (more than one model) because Huawei seems to provide the list in the ascending order of resolution (ie smallest-first), whereas most other devices I've seen does that in descending order (ie largest-first).如果您使用了网络上的一些代码片段,建议获取支持的图像大小列表,然后选择第一个 - 那么这在华为设备(多个型号)上对我来说适得其反,因为华为似乎在分辨率的升序(即最小优先),而我见过的大多数其他设备都是按降序排列(即最大优先)。

So if this is a resolution issue, it might be worth a check.因此,如果这是一个分辨率问题,则可能值得检查一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM