seeing-things / zwo

ZWO SDK and custom software for debugging and using it.
23 stars 4 forks source link

Improve AGC #9

Open bgottula opened 5 years ago

bgottula commented 5 years ago

A crude AGC was added to the capture software under #1 but it was not extensively tested. Known or suspected issues:

bgottula commented 5 years ago

An idea tried on nix was to set the histogram threshold based on a number of allowed saturated pixels, rather than a percentile:

         // Calculate Nth percentile pixel value
-        constexpr float percentile = 1.0;
-        uint32_t integral_threshold = (uint32_t)((1.0 - percentile) * Frame::IMAGE_SIZE_BYTES);
+        constexpr float percentile = 0.999;
+       constexpr int max_saturated_pixels = 10;
+        //uint32_t integral_threshold = (uint32_t)((1.0 - percentile) * Frame::IMAGE_SIZE_BYTES);
+        uint32_t integral_threshold = max_saturated_pixels;