OpenCV - 读取 Python 中的 16 位 TIFF 图像(sentinel-1 数据)
OpenCV - Read 16 bit TIFF image in Python (sentinel-1 data)
我正在尝试读取 Python 中的 16 位 TIFF 图像 (26446 x 16688)。使用 OpenCV 仅读取黑色图像(所有强度读数为 0):
self.img = cv2.imread(self.filename, cv2.IMREAD_UNCHANGED)
openCV 可以处理 16 位或大图像 (~840mb) 吗?任何解决方法?
编辑:还有
cv2.imshow("output", self.img[0:600])
显示黑色图像。
正如 Andrew Paxson 所建议的,可以使用不同的库。有一个专门用于播放 tiff
图像的库。
同样使用下面的代码。确保您的系统中安装了 tif
。
import tifffile as tiff
import matplotlib.pyplot as plt
filename = 'Image.tif'
img = tiff.imread(filename)
plt.imshow(img)
使用特定于栅格数据的图像库(在您的例子中是 sentinel-1)。例如,您可以使用 rasterio
来读取和显示卫星图像。
示例:
import rasterio
from rasterio.plot import show
img = rasterio.open("image.tif")
show(img)
我正在尝试读取 Python 中的 16 位 TIFF 图像 (26446 x 16688)。使用 OpenCV 仅读取黑色图像(所有强度读数为 0):
self.img = cv2.imread(self.filename, cv2.IMREAD_UNCHANGED)
openCV 可以处理 16 位或大图像 (~840mb) 吗?任何解决方法?
编辑:还有
cv2.imshow("output", self.img[0:600])
显示黑色图像。
正如 Andrew Paxson 所建议的,可以使用不同的库。有一个专门用于播放 tiff
图像的库。
同样使用下面的代码。确保您的系统中安装了 tif
。
import tifffile as tiff
import matplotlib.pyplot as plt
filename = 'Image.tif'
img = tiff.imread(filename)
plt.imshow(img)
使用特定于栅格数据的图像库(在您的例子中是 sentinel-1)。例如,您可以使用 rasterio
来读取和显示卫星图像。
示例:
import rasterio
from rasterio.plot import show
img = rasterio.open("image.tif")
show(img)