我有以下问题:我用显微镜保存16位tiff图像,我需要分析它们.我想用numpy和matplotlib做到这一点,但是当我想做一些简单的事情,比如用绿色绘制图像(我稍后需要叠加其他图像)时,它会失败.
这是一个例子,当我尝试将图像绘制为RGB数组或默认色图jet.
import numpy as np
import matplotlib.pyplot as plt
import cv2
imageName = 'image.tif'
# image as luminance
img1 = cv2.imread(imageName,-1)
# image as RGB array
shape = (img1.shape[0], img1.shape[1], 3)
img2 = np.zeros(shape,dtype='uint16')
img2[...,1] += img1
fig = plt.figure(figsize=(20,8))
ax1 = fig.add_subplot(1,2,1)
ax2 = fig.add_subplot(1,2,2)
im1 = ax1.imshow(img1,interpolation='none')
im2 = ax2.imshow(img2,interpolation='none')
fig.show()
Run Code Online (Sandbox Code Playgroud)
对我来说,产生了下图: 
如果这个问题太基础,我很抱歉,但我不知道为什么正确的情节会显示这些文物.我想得到绿色比例,类似于图形看起来(图像J也产生类似于左图的东西).
非常感谢您的合作.