How can I measure the level of ambient light from an image?

后端 未结 3 1933
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 20:01

I am looking at making an app that uses a camera to measure the amount of light present when an image is taken. Some conditional behavior would take place based on how much

3条回答
  •  旧巷少年郎
    2021-01-20 20:53

    A very rough estimate could be made by converting each colour channel value of each pixel to its intensity, using the known or assumed gamma of the camera. Then just sum the intensities across the whole image.

    If you want the level to approximate that observed by a human, you will weight the green channel intensity higher and the blue channel lower (since our eyes are particularly sensitive to green, and insensitive to blue).

提交回复
热议问题