Python Adaptation of rnc-color-stretch

Python adaptation of rnc-color-stretch, an image stretching software used for post-processing stacked astrophotography images originally written in davinci by Roger N. Clark.

Motivation

Post-processing is, in my opinion, one of the best parts of the astrophotography hobby. It can be quite relaxing to sit into the hours of the night with a cup of tea and slowly reveal faint details in an image you took earlier. However, when time is more scarce and you just want to see if the shoot was a success, getting even a decent result can be quite challenging on short notice.

Roger N. Clark's work on the rnc-color-stretch software aims to generate a good color-preserving stretch by utilizing a predefined algorithm coded in davinci. If used correctly, it can produce in minutes what would otherwise take hours. I still think the human touch through manual editing can produce better results, but it is certainly an interesting and powerful approach.

Davinci is, however, quite obscure and a pain to set up. Additionally, the rnc-color-stretch itself has not, as of writing, been updated since 2017. I therefore decided to adapt the source code to Python, a framework I'm much more comfortable in. It also presented an excellent opportunity for me to learn more about computational image processing, a field I find most interesting.

Usage

All code is contained in a single file and can be run by the following commands.


      python rnc_color_stretch.py <image>.tiff
    

Configuration parameters can be seen by calling with the helper flag.


      python rnc_color_stretch.py --help
    

Result Comparison

Below you will find a series of photographs I've taken. Each image is represented by their unedited stack, original davinci and my Python rnc-color-stretch implementations This project's goal is, of course, that the davinci and Python implementations should match.

All examples below use the default parameters for comparison purposes. You can improve the results by fine-tuning the parameters per image.

Thoughts

Overall I think the rnc-color-stretch does an excellent job for what it is. I am no veteran astrophotography editor, but the algorithm does a good job matching both the color and details of the manual stretches, in most cases. There are, of course, a certain air of subjective bias in all post-processing, and I do still prefer the manual edits, but this will certainly become another tool in my kit going forward.

Copyright and Licence

Copyright (c) 2016, Roger N. Clark, clarkvision.com

http://www.clarkvision.com/articles/astrophotography.software/rnc-color-stretch/

All rights reserved.

GNU General Public License https://www.gnu.org/licenses/gpl.html

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.