# The dehalo method for deep sky objects using GIMP.

As previously discussed in https://roslistonastronomy.uk/window-sill-trapezium-dehaloed

Here is the method in words:

Preamble.

We need to do 2 things.

1. We need to create an image which will provide the in-fill for the dark haloes.
2. We need to create a layer mask that just has the haloes, but is otherwise opaque. We then use this mask and the in-fill image to fill-in the haloes.

To do 1 above we are going to use a “median blur”, and it is probably worth-while just explaining what this is.

Normally, when we filter, smooth or blur data we use an averaging technique. A straightforward “moving average” is just that – an average of the data in a “window”. A “Gaussian blur” is similar, but this is a “weighted” moving average.

For example, let us consider a very simple example where the image data represented as numbers is a smooth progression, say (1,2,3,4,5). The average of the numbers in this window is (1+2+3+4+5)/5 =3.

A Gaussian weighting scheme might be (1,4,5,4,1), and this weighted moving average is        (1X1+ 4X2 +5X3+4X4+1X5)/15 = 3 again. Note that this time the divisor is the sum of the weighting coefficients.

Now suppose we have a very “bright” point replacing the “4” point with “100”. The data is now (1,2,3,100,5). The average is now 22.2 and the weighted moving average is 28.6. Obviously the effect of the “100” point is reduced, but it is still there in the blurred data.

A “median” is the point where there are as many points above the point as below. So the median of (1,2,3,4,5) is 3, and the median of (1,2,3,100,5) is also 3. In other words the anomalous “100” point has completely gone from the “blurred” data.

So let us now apply this to an image with haloes in it.

In GIMP

1. Open image file
2. Click on “Windows”, then on “Dockable dialogs”, then “Layers”. This opens a “Layers” window.
3. Right click on the layer that is there and then on “Duplicate layer”. We now have 2 copies of the layer
4. Highlight the top layer, then click on “Filters” then “Blur” then “Median Blur”
5. Expand the “Radius” until the haloes disappear. As explained above, because this is a median blur, the bright stars have little effect.
6. Drag the lower layer up so it is on top. We are now going to create the layer mask.
8. Select “Greyscale copy of layer” from the resultant window.
9. Right click the top layer, click on “Show Layer Mask”, and, operating on the mask, click on “Filters”, then “Enhance”, then “High pass”.
10. We now have a high pass filtered version of the mask.
11. Click on “Colours”, then “Curves”. Manipulate the “Curves” to get a dominantly white screen with black where you want to in-fill (ie the haloes).
12. We can now expand the haloes on the mask. Click on “Filters” then “Blur” then “Median Blur”.
13. Reduce the “Radius” to 1, and the “Percentile” to around 20.
14. Right click the top layer and uncheck the “Show Layer Mask” and you should see the result.
15. If you don’t like it, Click on “Edit” and “Undo” and manipulate the parameters on the mask and try again.
16. Once you have something you like, highlight the top layer, click on “Layer” on the top toolbar and then “Merge Down”.
17. Export the result with a name and format of your choice.

All this might seem a bit involved, but it’s a bit like trying to explain how to ride a bike in words. Like riding a bike, once you get the hang of it, it is dead easy!

And here it is with some screenshots:

A dehalo method 3

This site uses Akismet to reduce spam. Learn how your comment data is processed.