Python:如何读取 16 位 .png 灰度图像 [英] Python: How to read in a 16 bit .png grayscale image

查看:162
本文介绍了Python:如何读取 16 位 .png 灰度图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 python 中读取 16 位灰度图像 .png.

I try to read in a 16bit grayscale image .png in python.

都没有

cv2.imread('test.png', cv2.IMREAD_ANYDEPTH)

也没有

cv2.imread('test.png',-1)

正在工作.读入后,我的数组是 8 位.我很困惑,我的图像是否是 16 位图像,因为两者都向我打印了一个 8 位数组(但我很确定它是一个 16 位图像).有没有可能检查一下?

is working. After reading in, my array is 8 bit. I'm confused, wether my image is a 16 bit image or not, because both prints me a 8 bit array (But I am pretty sure it is a 16 bit image). Is there a possibility to check it?

但有谁知道如何读取 16 位 .png 文件以获取 16 位数组?

But does anyone know how to read in a 16 bit .png file to get an 16 bit array?

推荐答案

cv2.imread('test.png', -cv2.IMREAD_ANYDEPTH)

这篇关于Python:如何读取 16 位 .png 灰度图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆