问题
When importing a fits image in python it gets imported upside down.
This is the code i'm using:
import numpy as np
from astropy.io get fits
import matplotlib.pyplot as plt
im = fits.getdata('myimage.fits')
plt.imshow(im, cmap='gray')
plt.colorbar()
Again I just want to view the image and it opens upside down. When I open it in an image viewer I have on my computer it looks fine so I know I didn't save it upside down. Is there any way to prevent this from happening?
回答1:
You can specify the keyword argument origin= 'lower' or origin='upper' in your call to imshow.
来源:https://stackoverflow.com/questions/59073379/how-to-stop-fits-files-from-being-imported-upside-down-python