Artash Nath

I am a Grade 6 student and a member of Royal Astronomical Society of Canada (RASC) – Toronto. One of the best parts of being a Member is that I get to visit the Carr Astronomical Observatory (CAO) and observe the night sky using a research grade telescope. And stay up late in the night!

Artash Working on M51-2
Artash working on M-51 Chandra X-Ray Observatory Images

One of my favourite deep sky / Messier Objects to observe is the Whirlpool Galaxy (M51) – a spiral galaxy located within the constellation – Canes Venatici, 23 million light-years away. It appears nice and bright – far better than the fuzzy and nebulous views of several other dim Messier Objects.

In addition to Astronomy and Space, I love Coding and Music. I am always excited about taking up projects where I can bring my interests together.

My Project: Using Python and OpenCV on Astronomical Images

I have done many projects in Python language and am now learning more about image recognition and machine learning using OpenCV (Open Source Computer Vision Library) and Num Py. On the Pi Day (14 March 2018), I was browsing the website of the Chandra X-ray Observatory – NASA’s flagship X-ray telescope, named after the Subrahmanyan Chandrasekhar – an Indian American astrophysicist.  There I came across a composite image of the M-51 Galaxy taken on 1 March 2018 through combining images from Chandra (in X-Ray, purple) and the Hubble telescope (in Visible, red, green, and blue).

M-51 Galaxy Composite Image (1 March 2018). Source:

The Computer Vision Process
I decided to use the OpenCV library with Python to analyze the image of M-51. I wrote a program which determined the (Hue Saturation Value) HSV values of different pixels. I then created filters which would identify regions which matched the threshold values I set for the filters. I made several images using different threshold values and masking to bring about different features of the M-51 Galaxy, namely the spiral arms, dust clouds, star-forming regions, and most interestingly – the Ultra Luminous (ULX) X-Ray source! The Astronomers have used Chandra data to determine that an ultraluminous X-ray source (ULX) contains a neutron star. 

It was my first foray into the use of computer vision and Python for astronomical objects. Earlier I had used Python and Artificial Intelligence (Neural Networks) for predicting risk index of Asteroid collision with Earth.

What I Learnt?

Through this project, I learnt that OpenCV has very interesting applications in Astronomy. Applying OpenCV could bring about image characteristics which are not normally clear to the human eye. It allows us to subtract features which we do not want and focus on features that we do. For example, I could set filter settings which would allow me to only focus on the Ultra Luminous X-Ray Sources (ULX) or the spiral arms of M51 in the Chandra image.

Furthermore, image processing could provide training images for an add-on machine learning programme. The machine learning programme could then speed up analysis of data from different ground and space-based telescopes and draw attention to conclusions or patterns overlooked by researchers.

And What I Found Out, Unexpectedly?

On analyzing one of the M-51 images that I had processed, I noted that the brightness pattern was distributed unevenly around the spiral arms. There was a bigger bright patch at one of the spiral arms as compared to the diametrically opposite side. I found it very intriguing.

So I went back to the Chandra X-Ray Observatory website and looked at an old composite picture of M-51 of 3 June 2014. In that picture, I saw the companion galaxy – NGC 5195 (also known as Messier 51b or M51b) – a dwarf galaxy that is interacting with the Whirlpool Galaxy. As NGC 5195 drifts by, it is gravitationally interacting with M51 galaxy causing star-forming regions to form because of greater availability of dust and gas clouds. Consequently, these regions are rich in bright blue stars and appear as big bright patch in the processed images.

M51 collide
Composite Image of M-51 Whirlpool Galaxy interacting with Companion Galaxy NGC5195. Source:

I found it most amazing that there is so much we could learn about an object so far away (23 million light years) using open source data from NASA websites, open source tools, and lots of hard work, time and curiosity!

We are now a little bit more aware of our Universe.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s