I'm noticing some unusual flickering noise on the Pixel 5 when attempting to perform analysis on frames at 60 fps while also displaying a preview. This doesn't seem to happen when capturing frames at 30 fps, or when there is no preview.
I've
created a simple demo project to reproduce the issue, and have
captured the results in a spreadsheet, showing an example analysis output at 60 fps with and without preview and 30 fps with and without preview. I also ran the demo against a Samsung Galaxy S20 FE for comparison. These scenarios are represented by different tabs in the spreadsheet.
To reproduce the issue, please check out the project and modify SHOW_PREVIEW and FRAMERATE constants in MainActivity.kt. The demo project simply captures frame luma for 10 seconds, optionally displaying a preview, and when finished prints out each frame's total luma. I tested both the Pixel 5 and Galaxy S20 FE by resting them a few millimeters off a dark mat. If your results are like mine, the Pixel 5's preview will be very noisy when displaying a preview and requesting a framerate of 60 fps.
To better illustrate the point, here's a few graphs.
My questions:
- Is this a bug in CameraX's support for the Pixel 5, or am I using one of the Camera2 request options incorrectly?
- I'm reading CameraCharacteristics.CONTROL_AE_AVAILBLE_TARGET_FPS_RANGES to determine the best (highest) framerate to capture frame data. Is that a valid approach?
- If this isn't a bug, is there a recommended approach for avoiding this kind of noise?