DIY Scilab gradient removal on M31

Discuss how you are able to get those fantastic images!!!
Post Reply
User avatar
SkyHiker United States of America
Local Group Ambassador
Articles: 0
Offline
Posts: 2293
Joined: Sat May 11, 2019 8:40 pm
4
Location: Santa Barbara, CA
Status:
Offline

TSS Awards Badges

TSS Photo of the Day

DIY Scilab gradient removal on M31

#1

Post by SkyHiker »


I am clinging to Gimp for my AP processing just because it's a general tool and I don't like to learn hundreds of scripts to get a few simple things done. While Gimp has gradient removal, it is a bit limited in that the gradient is built up of parallel lines according to a linear or circular profile, with some ways to refine it through the GUI. As a result it also introduces gradients if those gradients are not compatible with Gimp's model.

So I ended up doing a lot of work each time and got tired of it. But Gimp has a plugin capability for Python so I decided to try Python to fix it. Unfortunately Gimp's Python does not have numpy and scipy, and if it did it bothers the programmer with more detail about data types and function calls than is reasonable. So I tried Scilab using the IPCV toolbox to load and save images.

Here's the original image from a 2 hour session with the Astrocat51, stretched in DSS and size reduced in Paint.
m31_dss_forGimp_small.jpg
In Gimp I wanted to mask out the nebulosity and most of the bright stars. For this I created a mask. I won't go into detail, just learn how to do this in Gimp. The mask shows some lines in the starry area where I did this in two steps but don't worry I average over the non-black areas later on so it won't affect the estimated gradient intensity. Here's the mask:
m31_dss_forGimp_smallMask.jpg
Then I multiplied the original image with the mask in Gimp, resulting in the base for the gradient estimation:
m31_dss_forGimp_maskedBackground.jpg
My Scilab script imported this. It ran a least squares estimate using Chebyshev polynomials up to 5th order. The data is based on dividing the image in cells. The number of cells is based on the number of data points per parameter that I wanted (10), also accounting fot the blacked-out areas. The estimated gradient is this:
grad.jpg
Subtracting the gradient from the original image here is the result:
newImg.jpg
This is not bad for a first try! The Scilab script is honestly just a few lines. It handles multidimensional matrix manipulation with ease so the code is very understandable. I'm going to check how I can use this as a Gimp plugin (rather than writing Python).
... Henk. :D Telescopes: GSO 12" Astrograph, "Comet Hunter" MN152, ES ED127CF, ES ED80, WO Redcat51, Z12, AT6RC, Celestron Skymaster 20x80, Mounts and tripod: Losmandy G11S with OnStep, AVX, Tiltall, Cameras: ASI2600MC, ASI2600MM, ASI120 mini, Fuji X-a1, Canon XSi, T6, ELPH 100HS, DIY: OnStep controller, Pi4b/power rig, Afocal adapter, Foldable Dob base, Az/Alt Dob setting circles, Accessories: ZWO 36 mm filter wheel, TV Paracorr 2, Baader MPCC Mk III, ES FF, SSAG, QHY OAG-M, EAF electronic focuser, Plossls, Barlows, Telrad, Laser collimators (Seben LK1, Z12, Howie Glatter), Cheshire, 2 Orion RACIs 8x50, Software: KStars-Ekos, DSS, PHD2, Nebulosity, Photo Gallery, Gimp, CHDK, Computers:Pi4b, 2x running KStars/Ekos, Toshiba Satellite 17", Website:Henk's astro images
User avatar
bobharmony
Local Group Ambassador
Articles: 0
Offline
Posts: 2028
Joined: Sun May 12, 2019 1:11 pm
4
Location: Connecticut, US
Status:
Offline

TSS Photo of the Day

Re: DIY Scilab gradient removal on M31

#2

Post by bobharmony »


That is a very nice result, Henk! It keeps the extended galaxy disk in the upper left corner of the images despite that area having the highest gradient. It looks like you have a tool worthy of the work needed to fit into your process.

Bob
Hardware: Celestron C6-N w/ Advanced GTmount, Baader MK iii CC, Orion ST-80, Canon 60D (unmodded), Nikon D5300 (modded), Orion SSAG
Software: BYE, APT, PHD2, DSS, PhotoShop CC 2020, StarTools, Cartes du Ciel, AstroTortilla

Image
User avatar
SkyHiker United States of America
Local Group Ambassador
Articles: 0
Offline
Posts: 2293
Joined: Sat May 11, 2019 8:40 pm
4
Location: Santa Barbara, CA
Status:
Offline

TSS Awards Badges

TSS Photo of the Day

Re: DIY Scilab gradient removal on M31

#3

Post by SkyHiker »


bobharmony wrote: Mon Nov 01, 2021 6:31 pm That is a very nice result, Henk! It keeps the extended galaxy disk in the upper left corner of the images despite that area having the highest gradient. It looks like you have a tool worthy of the work needed to fit into your process.

Bob
Thanks Bob. Yes it worked out quite well. I have some ideas for a few tweaks to improve the result.

One is (this was implemented by mistake during the implementation process) to weight the blacked-out area in the least squares estimation as well. Doing that will make the gradient dive down in those areas, which benefits the nebulosity near the edges. The reason why I say that is that the purple nebulosity near the lower right of M31 has beeen reduced more than I like. So I can offer that as an option.

Another thing is that the stars are noticeably less bright in the parts where the highest gradients were. The reason of course is that I subtracted it so the remaining signal becomes less. I can correct for that afterwards multiplicatively using the value of the estimated gradient, I think.

And the over all result has a sightly unnaturally black backgorund. Not bad at all though! I could offer the option to subtract a factor times the estimated gradient, like 0.8 or so. The problem is that the selected gradient area may still have a bit too much light from small stars that escaped the Threshold mask in Gimp. So it's value may be slightly on the high side and it can be corrected as suggested.
... Henk. :D Telescopes: GSO 12" Astrograph, "Comet Hunter" MN152, ES ED127CF, ES ED80, WO Redcat51, Z12, AT6RC, Celestron Skymaster 20x80, Mounts and tripod: Losmandy G11S with OnStep, AVX, Tiltall, Cameras: ASI2600MC, ASI2600MM, ASI120 mini, Fuji X-a1, Canon XSi, T6, ELPH 100HS, DIY: OnStep controller, Pi4b/power rig, Afocal adapter, Foldable Dob base, Az/Alt Dob setting circles, Accessories: ZWO 36 mm filter wheel, TV Paracorr 2, Baader MPCC Mk III, ES FF, SSAG, QHY OAG-M, EAF electronic focuser, Plossls, Barlows, Telrad, Laser collimators (Seben LK1, Z12, Howie Glatter), Cheshire, 2 Orion RACIs 8x50, Software: KStars-Ekos, DSS, PHD2, Nebulosity, Photo Gallery, Gimp, CHDK, Computers:Pi4b, 2x running KStars/Ekos, Toshiba Satellite 17", Website:Henk's astro images
User avatar
Juno16 United States of America
Universal Ambassador
Articles: 0
Offline
Posts: 8195
Joined: Sun May 12, 2019 3:13 pm
4
Location: Mississippi Gulf Coast
Status:
Offline

TSS Awards Badges

TSS Photo of the Day

Re: DIY Scilab gradient removal on M31

#4

Post by Juno16 »


That is pretty cool Henk! Looks like the script really works well!
Jim

Scopes: Explore Scientific ED102 APO, Sharpstar 61 EDPH II APO, Samyang 135 F2 (still on the Nikon).
Mount: Skywatcher HEQ5 Pro with Rowan Belt Mod
Stuff: ASI EAF Focus Motor (x2), Orion 50mm Guide Scope, ZWO 30 mm Guide Scope, ASI 220mm min, ASI 120mm mini, Stellarview 0.8 FR/FF, Sharpstar 0.8 FR/FF, Mele Overloock 3C.
Camera/Filters/Software: ASI 533 mc pro, ASI 120mm mini, Orion SSAG, IDAS LPS D-1, Optolong L-Enhance, ZWO UV/IR Cut, N.I.N.A., Green Swamp Server, PHD2, Adobe Photoshop CC, Pixinsight.
Dog and best bud: Jack
Sky: Bortle 6-7
My Astrobin: https://www.astrobin.com/users/Juno16/
User avatar
STEVE333 United States of America
Inter-Galactic Ambassador
Articles: 0
Offline
Posts: 3466
Joined: Sat May 11, 2019 5:01 pm
4
Location: Santa Cruz, Ca, USA
Status:
Offline

TSS Awards Badges

TSS Photo of the Day

Re: DIY Scilab gradient removal on M31

#5

Post by STEVE333 »


Nice improvement Henk. Good luck with the new ideas.

Steve
Steve King: Light Pollution (Bortle 5)
Telescope + Mount + Guiding: W.O. Star71-ii + iOptron CEM40 EC + Orion Magnificent Mini AutoGuider
Camera: ASI 1600MM Pro + EFW Filter Wheel + Chroma 3nm Siii, Ha, Oiii + ZWO LRGB Filters
Software: PHD2; APT; PixInsight ***** My AP website: www.steveking.pictures
Image
Image
User avatar
messier 111 Canada
Universal Ambassador
Articles: 0
Offline
Posts: 9482
Joined: Mon Nov 09, 2020 2:49 am
3
Location: Canada's capital region .
Status:
Offline

TSS Awards Badges

Re: DIY Scilab gradient removal on M31

#6

Post by messier 111 »


nice work , thx .
I LOVE REFRACTORS , :Astronomer1: :sprefac:

REFRACTOR , TS-Optics Doublet SD-APO 125 mm f/7.8 . Lunt 80mm MT Ha Doublet Refractor .

EYEPIECES, Delos , Delite and 26mm Nagler t5 , 2 zoom Svbony 7-21 , Orion Premium Linear BinoViewer .

FILTER , Nebustar 2 tele vue . Apm solar wedge . contrast booster 2 inches .

Mounts , berno mack 3 with telepod , cg-4 motorized , eq6 pro belt drive .

“Your assumptions are your windows on the world. Scrub them off every once in a while, or the light won't come in.”
― Isaac Asimov

Jean-Yves :flags-canada:
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Image processing”