How to detect average pixel intensity from live camera preview?

后端 未结 2 929
半阙折子戏
半阙折子戏 2021-01-21 17:32

I am building a scanner app, and trying to determine the \"preview quality\" from the preview callback of the camera. I want to customize the camera\'s AUTO_FLASH_MODE

2条回答
  •  情深已故
    2021-01-21 18:09

    Either find out how to access pixel values of your image and calculate the average intensity yourself or use any image processing library to do so.

    Dark pixels have low values, bright pixels have high values. You want to calculate the average of all red, green and blue values divided by three times your pixel count. Define a threshold for when to turn on the flash, but keep in mind that you have to get a new exposure time then. Prefer flash over exposure time increase as long exposure times yield higher image noise.

提交回复
热议问题