小编Ziy*_* He的帖子

在读取4通道tif文件时,其值与SKIMAGE,TIFFFILE等不同

我知道opencv有一个BGR命令,但在我的实验中,不仅顺序而且值也完全混乱

import cv2 as cv
import tifffile as tiff
import skimage.io

img_path = r"C:\test\pics\t100r50s16_1_19.tif"
c = cv.imread(img_path,cv.IMREAD_UNCHANGED)
t = tiff.imread(img_path)
s = skimage.io.imread(img_path)

print("c:", c.shape, "t:", t.shape, "s:", s.shape)
print("c:", c.dtype, "t:", t.dtype, "s:", s.dtype)

print(c[0, 0], c[1023, 0], c[0, 1023], c[1023, 1023])
print(t[0, 0], t[1023, 0], t[0, 1023], t[1023, 1023])
print(s[0, 0], s[1023, 0], s[0, 1023], s[1023, 1023])

print(c.sum())
print(t.sum())
print(s.sum())
Run Code Online (Sandbox Code Playgroud)

输出如下:

c: (1024, 1024, 4) t: (1024, 1024, 4) s: (1024, 1024, 4)
c: uint8 t: uint8 s: …
Run Code Online (Sandbox Code Playgroud)

opencv tiff scikit-image

5
推荐指数
1
解决办法
268
查看次数

标签 统计

opencv ×1

scikit-image ×1

tiff ×1