OpenCV-读取16位灰度图像 [英] OpenCV - Reading a 16 bit grayscale image

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

问题描述

我正在尝试在Python中使用OpenCV 2.4读取16位灰度图像,但似乎正在将其加载为8位.

I'm trying to read a 16 bit grayscale image using OpenCV 2.4 in Python, but it seems to be loading it as 8 bit.

我正在做

im = cv2.imread(path,0)
print im

[[25 25 28 ...,  0  0  0]
[ 0  0  0 ...,  0  0  0]
[ 0  0  0 ...,  0  0  0]
..., 

如何获得16位?

推荐答案

弄清楚了.万一其他人遇到这个问题:

Figured it out. In case anyone else runs into this problem:

im = cv2.imread(path,-1)

将标志设置为0(以灰度加载)似乎默认为8位.设置为-1将按原样加载图像.

Setting the flag to 0, to load as grayscale seems to default to 8 bit. Setting to -1 loads the image as is.

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

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