简体   繁体   English

对一个通道图像使用不同的颜色图 - cv2.imshow()

[英]Use different colormap with one channel image - cv2.imshow()

When I use this method with an 1 channel image, it's shown in grayscale.当我将此方法用于 1 通道图像时,它以灰度显示。 Is there a way to use other color maps (not grayscale) when showing an 1 channel image?显示 1 通道图像时有没有办法使用其他颜色图(不是灰度图)? If there is, it means grayscale is the default for imshow when working with an image with only 1 channel?如果有,这意味着当处理只有 1 个通道的图像时,灰度是 imshow 的默认值? Thanks in advance提前致谢

As far as I know, you cannot apply a color map in Python/OpenCV cv2.imshow like you can with Mathplotlib pyplot.据我所知,您不能像使用 Mathplotlib pyplot 那样在 Python/OpenCV cv2.imshow 中应用颜色 map。 But you can create a color map and apply it to your grayscale image using cv2.LUT to change your grayscale image into a colored image that you can display with cv2.imshow.但是您可以创建一个颜色 map 并使用 cv2.LUT 将其应用于您的灰度图像,以将您的灰度图像更改为可以使用 cv2.imshow 显示的彩色图像。

Please see the documentation for cv2.imshow at https://docs.opencv.org/4.1.1/d7/dfc/group__highgui.html#ga453d42fe4cb60e5723281a89973ee563请参阅https://docs.opencv.org/4.1.1/d7/dfc/group__highgui.html#ga453d42fe4cb60e572563281a8997ee3处的 cv2.imshow 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM