0

如何使用 cv2 打开 16 位 1 通道灰度图像?我不想转换文件。该文件已经是我需要的形式。

In [62]: image = cv2.imread(file, -1)

In [63]: image.dtype
Out[63]: dtype('uint8')

In [64]: image.shape
Out[64]: (1280, 960, 3)     # 3 channels of uint8

In [76]: image.size
Out[76]: 3686400

===========================================

In [65]: image = cv2.imread(file, 0)

In [66]: image.dtype
Out[66]: dtype('uint8')

In [67]: image.shape
Out[67]: (1280, 960)       # one channel of uint8

In [74]: image.size
Out[74]: 1228800
===========================================

In [69]: image = cv2.imread(file, 1)

In [70]: image.dtype
Out[70]: dtype('uint8')

In [71]: image.shape
Out[71]: (1280, 960, 3)        # 3 channels of uint8

In [72]: image.size
Out[72]: 3686400

我期待 1 个 uint16 通道,文件大小应为 2457600

4

0 回答 0