python - 在 Jupyter notebook 中使用 OpenCV 查看 tif 图像文件
问题描述
我有一个 TIF 格式的热图像,我可以display
在 Ubuntu 中使用命令看到它。我还从图像文件中获得了以下信息:
$ file Rec-000026_16bit_counts.tif
Rec-000026_16bit_counts.tif: Big TIFF image data, little-endian
$ exiv2 Rec-000026_16bit_counts.tif
File name : Rec-000026_16bit_counts.tif
File size : 2097433 Bytes
MIME type :
Image size : 0 x 0
Rec-000026_16bit_counts.tif: No Exif data found in the file
还
$ tiffinfo Rec-000026_16bit_counts.tif
TIFF Directory at offset 0x200010 (2097168)
Image Width: 1024 Image Length: 1024
Bits/Sample: 16
Sample Format: unsigned integer
Compression Scheme: None
Photometric Interpretation: min-is-black
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Planar Configuration: single image plane
Software: ExaminIR
当我运行以下单元格时:
import cv2
img = cv2.imread("Rec-000026_16bit_counts.tif", cv2.IMREAD_UNCHANGED)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
我收到以下错误:
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-67-2756e499dadf> in <module>
1 import cv2
2 img = cv2.imread("Rec-000026_16bit_counts.tif", cv2.IMREAD_UNCHANGED)
----> 3 cv2.imshow('image',img)
4 cv2.waitKey(0)
5 cv2.destroyAllWindows()
error: OpenCV(3.4.9) /io/opencv/modules/highgui/src/window.cpp:382: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
我应该如何解决这个问题?
解决方案
推荐阅读
- java - 如何计算需要覆盖字符串的选项卡数
- sql - 电子商务结帐:何时何地在关系数据库中为购物车中的商品创建中间和最终订单
- javascript - 如何使页面的特定部分居中,使其与平滑滚动完美结合?
- c# - 使用 C# 创建文件
- reactjs - 我可以将 ref 存储在 Redux 存储中,还是被认为是不好的做法?
- mysql - 构建动态 SQL 查询以对有限制的记录进行排序
- php - 使用 ajax 和 jquery 的简单食物跟踪器
- javascript - 键“local_part”的重复条目“0-0”
- javascript - Codeceptjs 无法在不使用元素的情况下滚动/向下滑动
- python - 无法从 angel.co 网站抓取所有数据