分离Lab色彩空间中的黄色和蓝色通道

huangapple go评论45阅读模式
英文:

Image Processing: Separate Yellow and Blue Channels in Lab Color Space

问题

我是新手对图像处理不太了解,我被分配了一个任务,需要从只包含蓝色和黄色的图像中,通过白色边缘分离黄色(正值)和蓝色(负值)颜色。

不幸的是,我不知道应该如何分离这两种颜色。

而且,我在得到的图像像素中看不到任何负值。

不幸的是,我不能使用高级库,如OpenCv,而且大部分与图像处理相关的互联网教程都使用它。

分离Lab色彩空间中的黄色和蓝色通道

我将图像从RGB转换为Lab颜色空间。我在Python中进行操作,使用scikit-image库和其他有用的包。

如果有人能给我一些提示,我将不胜感激!谢谢。

英文:

I'm new to image processing, and I was given a task to separate the yellow (+ve values) and blue (-ve values) colors by a white edge from an image that contains only blue and yellow colors.

Unfortunately, I don't know how should I separate both colors.

Also, I cannot see any negative values in the pixels of the image which I got.

Unfortunately, I cannot use an advanced libraries such as OpenCv and most of the tutorials related to image processing on the Internet uses it.

分离Lab色彩空间中的黄色和蓝色通道

I converted the image from RGB to Lab color space. I'm using Python for this and scikit-image library and other useful packages.

I'll be glad if anyone could help by giving me any hints!

Thanks

答案1

得分: 2

你需要找到一个颜色空间,其中黄色和蓝色能够很好地分开。在RGB颜色空间中(R在左边,G在中间,B在右边),分割通道并将它们分配到页面上:

RGB无边缘检测:

分离Lab色彩空间中的黄色和蓝色通道

RGB带有边缘检测:

分离Lab色彩空间中的黄色和蓝色通道

这并不是很好 - 材料捕捉到光线的明亮黄色部分被视为边缘。

让我们尝试使用Lab而不是RGBL在左边,a在中间,b在右边:

Lab无边缘检测:

分离Lab色彩空间中的黄色和蓝色通道

Lab带有边缘检测:

分离Lab色彩空间中的黄色和蓝色通道

依然不太好。现在让我们尝试HSV颜色空间,H在左边,S在中间,V在右边:

HSV无边缘检测:

分离Lab色彩空间中的黄色和蓝色通道

HSV带有边缘检测:

分离Lab色彩空间中的黄色和蓝色通道

希望你能看到H在左边是最好的。这是因为黄色在此图表中是60度,而蓝色是240度,因此这两种颜色是对立的 - 或者说是六边形中的圆直径。

然后,你需要进行边缘检测和加粗,然后可以通过选择“变亮”混合模式来将白色边缘叠加到黄色和蓝色的旗帜上,以便在图像的每个位置选择较亮的像素,以使白色边缘透过蓝色和黄色。

英文:

You need to find a colourspace where the yellows and the blues are well separated. Splitting the channels, and assigning them across the page, in RGB colourspace (with R on the left, G in the centre and B on the right):

RGB without edge detection:

分离Lab色彩空间中的黄色和蓝色通道

RGB with edge detection:

分离Lab色彩空间中的黄色和蓝色通道

that's not very good - the brighter tones of yellow where the material is catching the light are being treated like edges.

Let's try Lab instead of RGB with L on the left, a in the centre and b on the right:

Lab without edge detection:

分离Lab色彩空间中的黄色和蓝色通道

Lab with edge detection:

分离Lab色彩空间中的黄色和蓝色通道

Still not so good. Now let's try HSV colourspace, H on the left, S in the centre and V on the right:

HSV without edge detection:

分离Lab色彩空间中的黄色和蓝色通道

HSV with edge detection:

分离Lab色彩空间中的黄色和蓝色通道

And hopefully you can see that H on the left nails it. That's because yellow is 60 degrees and blue is 240 degrees in this diagram so your two colours are diametrically opposed - or whatever hexagons have in place of a circle's diameter.

Then you need to do edge detection, and fattening, then you can composite the white edge over the top of the yellow and blue flag by choosing a "lighten" blend mode where you choose the lighter pixel at each location in the images so that the white edges filter through the blue and yellow.

huangapple
  • 本文由 发表于 2023年3月3日 20:39:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627189.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定