如何停止适合文件从颠倒的python导入 [英] How to stop fits files from being imported upside down python
本文介绍了如何停止适合文件从颠倒的python导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在python中导入拟合图像时,它会上下颠倒导入.
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?
推荐答案
您可以在调用imshow时指定关键字参数origin ='lower'或origin ='upper'.
You can specify the keyword argument origin= 'lower' or origin='upper' in your call to imshow.
这篇关于如何停止适合文件从颠倒的python导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文