Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 有没有办法在Tkinter中显示16位图像?_Python_Numpy_Tkinter_Python Imaging Library_Cv2 - Fatal编程技术网

Python 有没有办法在Tkinter中显示16位图像?

Python 有没有办法在Tkinter中显示16位图像?,python,numpy,tkinter,python-imaging-library,cv2,Python,Numpy,Tkinter,Python Imaging Library,Cv2,我得到了一个单层uint16 tiff图像,即2d数组,每个值的范围在0-65355之间。 当我用cv2读取和显示图像时,它工作正常 im = cv2.imread(path, -1) cv2.imshow('im', im) 现在我正试图用Tkinter制作一个GUI,并将图像合并到GUI中,但它显示的只是一个白色画布 im = cv2.imread(path, -1) height = im.shape[0] width = im.shape[1] canvas.config(width=

我得到了一个单层uint16 tiff图像,即2d数组,每个值的范围在0-65355之间。 当我用cv2读取和显示图像时,它工作正常

im = cv2.imread(path, -1)
cv2.imshow('im', im)
现在我正试图用Tkinter制作一个GUI,并将图像合并到GUI中,但它显示的只是一个白色画布

im = cv2.imread(path, -1)
height = im.shape[0]
width = im.shape[1]
canvas.config(width=width, height=height)
image = Image.fromarray(im)
root.photo = photo = ImageTk.PhotoImage(image=image)
canvas.create_image(0, 0, image=photo, anchor=tk.NW)
其他类型的RGB 8bit图像显示为shuold。
如何显示图像?我做错了什么?

请参阅将模式设置为I;16这是uint16没有做任何相关的事情,它是一个单通道图像,没有RGB,只有强度读数