[英]Python and OpenCV: convert 16 bit image to gray image
I have a 16 bit image and I would like to convert it into gray. 我有一个16位图像,我想将其转换为灰色。
With 8 bit images it works fine with: 对于8位图像,它可以在以下情况下正常工作:
img = cv2.imread('test.png')
gray = cv2.cvtColor(gray, cv2.COLOR_BGR2GRAY)
People here in stackoverflow write that OpenCV doesn't work that good with more than 8 bit images ? 人们在stackoverflow上写道,OpenCV在8位以上的图像上不能很好地工作吗?
Does anyone know a possibility to convert my 16 bit .png image to gray? 有谁知道将我的16位.png图像转换为灰色的可能性?
It works with img.astype(np.uint16)
它与
img.astype(np.uint16)
and to check the documentation first is a very good hint! 并首先检查文档是一个很好的提示!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.