For my application I need to control the exposure, and the Pixy is complicated in having two settings, gain and compensation. Somehow the Pixy manages to make a pretty good choice quickly for those two interacting parameters. Is any information available on how that is done and when it actually happens? Upon a casual look-through nothing jumped out of the camera source code, so I assume this happens in the hardware.
I’ve done some tests to optimize the exposure histogram, by collecting fixed frames for a large selection of gain and compensation values. I calculated the mean, variance, minimum and maximum pixel value for a typical low light application setting, and it is clear from these data that the interaction between these two parameters is nonlinear and not easily modeled. It is also clear that a gain/compensation setting similar to that chosen by the camera maximizes the variance and gives a reasonable value for the average intensity, but making that choice by systematic search would be very time consuming.
The parameter choice does not appear to be critical, so ballpark values would probably be OK. Any hints on a fast algorithm for searching this nonlinear parameter space (or an explanation for how the camera does it) would be most welcome.
I’ve attached a spreadsheet from the latest experiment, a series of 2385 1280x50 frames. In successive columns are compensation, gain, pixel intensity mean, variance, min and max for the raw Bayer (uninterpolated) images. I’ve also attached a couple of surface plots showing how the frame variance (width of histogram) depends on compensation and gain. Note that the gain variable has a highly nonlinear effect, with peaks and valleys. The spreadsheet and plot labeled “variance.png” are from a low light exposure, while the second plot entitled “overcast.png” is a more normal lighting situation, with the overcast sky as a light source.
Sorry for the duplication of attachments. There seems to be no way to delete an attachment with the forum software.
Comments welcome!