OpenCV显示实验室Tif图片中的怪异颜色

发布于 2025-01-23 18:04:32 字数 990 浏览 2 评论 0原文

我正在尝试使用python的OpenCV显示图像,但它以不同的颜色显示。

原始图像(实验室颜色空间,tif文件扩展名)看起来像:

“在此处输入映像”

代码看起来像这样:

import cv2 as cv
img = cv.imread('Photos/example.tif') # read the image

当我使用cv.imshow('title',img)输出它时代码> 图片看起来像这样:

”在此处输入图像描述”

代码

LAB_img = cv.cvtColor(img, cv.COLOR_BGR2LAB)
cv.imshow('Title', LAB_img) # show the LAB version

所以我尝试了以下

“在此处输入映像”

我也尝试了rgb2lab或lab2bgr,结果输出都是诡异的。

有什么建议吗?谢谢。

I am trying to show an image using OpenCV with Python, but it appears with different colors.

The original image (LAB color space, TIF file extension) looks like this:

enter image description here

The code looks like this:

import cv2 as cv
img = cv.imread('Photos/example.tif') # read the image

When I output it using cv.imshow('Title', img)
The picture looks like this:

enter image description here

So I tried this line of code:

LAB_img = cv.cvtColor(img, cv.COLOR_BGR2LAB)
cv.imshow('Title', LAB_img) # show the LAB version

and the output looks like this:

enter image description here

I also tried RGB2LAB or LAB2BGR, and the result outputs are all weird.

Any suggestions? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文