Camera2 API-如何设置长时间曝光 [英] Camera2 API - How to set long exposure times

查看:1188
本文介绍了Camera2 API-如何设置长时间曝光的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用程序中以30秒的曝光时间捕获图像(我知道这是有可能的,因为库存相机允许这样做).

I'm trying to capture images with 30 seconds exposure times in my app (I know it's possible since the stock camera allows it).

但是SENSOR_INFO_EXPOSURE_TIME_RANGE(应该以纳秒为单位)为我提供了范围:

But SENSOR_INFO_EXPOSURE_TIME_RANGE (which it's supposed to be in nanoseconds) gives me the range :

13272 - 869661901

几秒钟之内就可以了

0.000013272 - 0.869661901

显然不到一秒钟.

如何使用更长的曝光时间?

How can I use longer exposure times?

提前谢谢!.

推荐答案

问题的答案:

不能.您检查了正确的信息并正确地对其进行了解释.您为曝光时间设置的任何大于此值的值都会被裁剪为最大数量.

You can't. You checked exactly the right information and interpreted it correctly. Any value you set for the exposure time longer than that will be clipped to that max amount.

您想要的答案:

通过伪造,您仍然可以得到想要的东西.您希望连续30秒的光子落在传感器上,而这是无法获得的.但是,通过累积价值30秒的光子,其中散布着微小的缺失间隔,您可以得到(几乎)无法分辨的东西.

You can still get what you want, though, by faking it. You want 30 continuous seconds' worth of photons falling on the sensor, which you can't get. But you can get something (virtually) indistinguishable from it by accumulating 30 seconds' worth of photons with tiny missing intervals interspersed.

在较高的层次上,您需要做的是创建CaptureRequest s的List并将其传递给CameraCaptureSession.captureBurst(...).这将以尽可能少的插播时间进行拍摄.当每帧图像数据可用时,将其传递到某处的某个新缓冲区中并累积信息(简单的逐点加法).使用Allocation作为输出Surface和某些RenderScript可能最合适.

At a high level, what you need to do is create a List of CaptureRequests and pass it to CameraCaptureSession.captureBurst(...). This will take the shots with as minimal an interstitial time as possible. When each frame of image data is available, pass it to some new buffer somewhere and accumulate the information (simple point-wise addition). This is probably most properly done with an Allocation as the output Surface and some RenderScript.

数据格式注释:

  • 正确的正确方法是使用RAW_SENSOR输出格式.这样,累积的输出实际上与整个30秒钟入射到传感器的光成正比.

  • The right way to do this is to use the RAW_SENSOR output format if you can. That way the accumulated output really is directly proportional to the light that was incident to the sensor over the whole 30s.

如果由于某些原因您不能使用它,我建议您使用YUV_420_888输出,并确保将色调映射曲线设置为线性(不幸的是,您必须手动创建一个两点的曲线).否则,引入的非线性将破坏我们的方案. (尽管我不确定简单的加法在线性YUV空间中是否正确,但这至少是第一种方法.)无论您使用这种方法还是RAW_SENSOR,您都可能希望应用自己的伽玛曲线/色调累积后进行映射以使其看起来正确".

If you can't use that, for some reason, I would recommend using YUV_420_888 output, and make sure you set the tone map curve to be linear (unfortunately you have to do this manually by creating a curve with two points). Otherwise the non-linearity introduced will ruin our scheme. (Although I'm not sure simple addition is exactly right in a linear YUV space, but it's a first approach at least.) Whether you use this approach or RAW_SENSOR, you'll probably want to apply your own gamma curve/tone map after accumulation to make it "look right."

出于对Pete的热爱,出于许多原因,请勿使用JPEG输出,其中最重要的一点是,这很可能会在两次曝光之间增加大量的间隙时间,从而破坏了我们的30s近似值连续曝光.

For the love of Pete don't use JPEG output, for many reasons, not the least of which is that this will most likely add a LOT of interstitial time between exposures, thereby ruining our approximation of 30s on continuous exposure.

关于暴露当量的说明:

这将几乎完全产生您想要的曝光,但是效果并不完全.它在两个方面有所不同.

This will produce almost exactly the exposure you want, but not quite. It differs in two ways.

  1. 在这段曝光时间的中间,会有少量的光子信息丢失时段.但是在时间范围内,您正在谈论的是(30s),这里缺少几毫秒的光线,所以微不足道.

  1. There will be small missing periods of photon information in the middle of this chunk of exposure time. But on the time scale you are talking about (30s), missing a few milliseconds of light here and there is trivial.

与您真正拍摄30秒的单次曝光相比,图像会稍微有点噪点.这是因为每次您从实际传感器中读取像素值时,都会在信息中添加一些电子噪声.因此,最终,您的附加噪声(针对您的特定问题的35次暴露)所产生的附加噪声将是单次暴露噪声的35倍.抱歉,无法解决此问题,但它甚至可能不会引起注意-相对于有意义的摄影信号而言,这通常很小.

The image will be slightly nosier than if you had taken a true single exposure of 30s. This is because each time you read out the pixel values from the actual sensor, a little electronic noise gets added to the information. So in the end you'll have 35 times as much of this additive noise (from the 35 exposures for your specific problem) as a single exposure would. There's no way around this, sorry, but it might not even be noticeable- this is usually fairly small relative to the meaningful photographic signal. It depends on the camera sensor quality (and ISO, but I imagine for this application you need that to be high.)

(奖励!)实际上,该曝光将是优越:在30秒钟曝光中可能已经饱和(纯白色)的区域在这些短得多的曝光中仍将保持清晰度,因此基本上可以确保您不会丢失高端细节. :-)

(Bonus!) This exposure will actually be superior in one way: Areas that might have been saturated (pure white) in a 30s exposure will still retain definition in these far shorter exposures, so you're basically guaranteed not to lose your high end details. :-)

这篇关于Camera2 API-如何设置长时间曝光的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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