Finding sunspots on fits image via OpenCV

1k views Asked by At

I am currently working with astronomical data(Images), and my task is to write a program which finds sunspots on given image in fits format.

As I understood, the task is OpenCV related, but I have encountered a huge obstacle with formats. The Image data is 2D float32 numpy array which when given to OpenCV loses all details.

I have tried converting float32 into uint8 as well, however the result was not good.

left: before(matplotlib), right: after(cv2)

As it is seen, details were lost and it is not a good picture to be finding spots on. So, maybe there is alternative way of solving this?

[import cv2

from astropy.io import fits
import matplotlib.pyplot as plt
import numpy as np

img_l = fits.open('hmi.Ic_45s.20170605_000000_TAI.2.continuum.fits')
img = img_l\[0\].data

plt.imshow(img) #Showing Image in matplotlib
cv2.imshow('',img) #The image is white round with black background

image = np.array(img/255, dtype = np.uint8) #Converting float32 to uint8
cv2.imshow('', image) #Getting converted image
0

There are 0 answers