Jump to content

NLCbanner2024.jpg.2478be509670e60c2d6efd04834b8b47.jpg

My own full-auto gradient extractor!


Ags

Recommended Posts

I live in a city and there are always nast gradients in my images. I've tried using Iris but don't get along with it, and I can't afford PixInsight just at the moment, so I thought I would have a go at writing my own using Java.

One thing I don't like about gradient extractors is they need you to click a lot of reference points before calculating the gradient, so my little tool selects the background for me. If the target is very big, it will think the target is part of the background, but as I use a 50/1.8 lens, that is not an issue for me, all my objects are small (except for the milky way). And it will be trivial to add a feature to manually exclude the foreground objects from the background calculation.

I've been testing it out with this image of the NaN which I of course intentionally made a mess of. ISO 1600 at f2.5? What was I thinking? Well I was thinking my new UHC filter would exclude more light than it did.

post-7369-0-60688800-1352656326_thumb.jp

The goal I set myself was to stretch the data in 16-bit mode before it goes into GIMP, and remove the milky sky background and the red gradient to the edges.

This is the end result of all my efforts (cropped of course). By my standards it is pretty good :-)

post-7369-0-54469800-1352656478_thumb.pn

As the original is overexposed, the image post gradient extraction is very dark, with the even the stars quite a dark shade of grey. Instead of a sky gradient I have a star gradient:

post-7369-0-27584800-1352656628_thumb.pn

The stars are almost invisible at the bottom of the image. So I have added my Dynamic Luminance Compensation filter :-), which rescales (stretches) the pixel values (per pixel) over the full 16-bit range, so if a pixel was fully exposed before gradient extraction it is fully exposed after gradient extraction. And if a pixel was barely brighter than the background before extraction, it is converted to a corresponding dark color just above black.

This is the same image gradient extracted with Dynamic Luminance Compensation applied! (Unfortunately it makes the image look over-processed because the background is much too strong, a less vicious image would be a better sales tool!) Also, because my scaling is so extreme at the borders, the red gradient I largely removed has been resurrected. Nevertheless, I am quite pleased so far with my one-click image processing!

post-7369-0-02039000-1352656920_thumb.pn

Link to comment
Share on other sites

Very cool. I almost felt getting up the couch and start writing my own.

How do you calculate the actual negative frame to subtract? I can sorta figure out the how to get the general gradiant out ( sample points from grid, eliminate points outside a certain deviation, calculate x-y trends to create frame), but the red along the edges puzzles me a bit more.

The starts are looking a bit reddish, but I am not quite sure how go around fixing it.

Link to comment
Share on other sites

In my final image I did give the red an extra stretch to give the nebulae some color (my camera is unmodded), so that probably explains the red stars.

To calculate the gradient, I bin the image 2x2 and then divide the image into sectors and find the minimum value per sector. It is a simple matter to interpolate between the sectors. For simplicity's sake I just do a linear interpolation, but then I blur the result to smooth it out. A separate gradient is calculated for R, G and B. A side effect of removing the gradient is the image roughly colorbalanced at the same time.

If any object is larger than a sector, it is mistaken for background of course. The other problem is the sector based approach undersamples regions of strong gradient.

Link to comment
Share on other sites

  • 2 weeks later...

I have been doing some more work to reduce banding in the images.

This is my new test shot - perhaps the worst gradient ever?

post-7369-0-73029200-1353858907_thumb.jp

My gradient calculator derives the following gradient:

post-7369-0-42103200-1353859140_thumb.jp

Simply subtracting the gradient results in this bad star gradient:

post-7369-0-00560400-1353859297_thumb.jp

My new stretching algorithm makes things a bit brighter but does not fix the star gradient:

post-7369-0-85466700-1353859412_thumb.jp

My dynamic stretch based on the local brightness of the gradient fixes the stars but makes the image look a bit hard:

post-7369-0-86628300-1353859558_thumb.jp

The gradient leaks back here - but running the extraction a second time would remove it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.