| Home | Galleries | Articles | Reviews | Best Gear | Science | New | About | Contact |

download rnc-color-stretch version 1.01: rnc-color-stretch-v1.01 (2023-06-23). Note: the windows GUI does not yet include the histogrambox1 parameter, so command line is needed to use new features. But the windows GUI willl work just like with older version, but better diagnostics.
New feature: -histogrambox1 limits the zero-point histogram to a smaller region. For the above
image, the command was:
rnc-color-stretch-v1.01 input_image -rootpower 6 -rootpower2 2 -skylevelfactor 0.008 -obase output_image_name
-histogrambox1 4900 180 20100 3350
The histogrambox1 upper left corner was pixel x y: 4900 180 and lower right pixel x y: 20100 3350, which is the darker sky near the top of the above image. The pixel coordinates were gotten from photoshop.
Key to best results is to limit the histogram box to a darker part of the scene in the sky (land is not relevant), and to make the skylevelfactor as low as possible. The default skylevelfactor is 0.06, which means to choose the neutral point at 6% of the peak histogram. If the histogram is the whole image, 6% may not be very dark. What can happen is for areas darker than that level, there can be a color reversal, e.g. making faint things blue or at least less red than they should be. A 2-level rootpower helps mitigate this as the image is stretched by the first rootpower, then the skylevelfactor is applied again, this time for the rootpower2 stretch. But lowering the skylevelfactor from the 0.06 default also helps. If the histogram box is small, the histogram may look "ratty" and the simple algorithm used to find the skylevelfactor may fail and an error results. Start with a low skylevelfactor (e.g. 0.002) and work up until it works. Or start at a little less than 0.06 and work down until it fails, then go back up a little.
Example error:
histogram sky level 0.002000 not found:
channels: red 3743 green 2097 blue 0
Thus, not sure what to do with this image because the histogram sky level is too low, quitting
Try raising the skylevelfactor and/or
Try raising the three rgbskyzero values.
The input data may be too low.
Instead of just increasing -rgbskyzero values try increasing skylevelfactor.
The histogrambox1 needs to contain enough pixels to provide enough statistics to find the zero point. For example, in the above image, I made a 2400 pixel wide image for testing parameters. A skylevelfactor of 0.006 failed, but 0.008 worked. But when I ran tests on the full resolution image with the histogrambox1 in the above comman line (-histogrambox1 4900 180 20100 3350) I was able to decrease the skylevelfactor to 0.001.
The color stretching script starts with the line:
#!/usr/bin/env -S davinci -fand will work on linux and macs where the env program is version 8.30 or later. Check by running the env program: env --version and if the versin is earlier than 8.30, install a newer version or change the first line to be:
#!/usr/local/bin/davinci -f
First Published June 23, 2023
Last updated June 23, 2023.