如何在EmguCV中将Bgr像素转换为Hsv像素? [英] How to convert Bgr pixel to Hsv pixel in EmguCV?
本文介绍了如何在EmguCV中将Bgr像素转换为Hsv像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将Bgr值(一个像素)转换为Hsv值。如何在EmguCV中做到这一点(无需从头开始编写转换代码)?
I'd like to convert a Bgr value (one pixel) to an Hsv value. How can I do that (without writing the conversion code from scratch) in EmguCV?
请注意,我不希望转换整个图像的色彩空间,而只转换一个像素,因此 CvInvoke.cvCvtColor()
不适用于我。
Please note that I am not interested in converting whole image's color space but only one pixel, therefore CvInvoke.cvCvtColor()
does not work for me.
推荐答案
好的,我已经找到了一种使用.NET框架帮助的方法
Okay I already found a way using some help from .NET framework
给出了 Bgr像素
;
1-将颜色转换为 System.Drawing.Color
:
System.Drawing.Color intermediate = System.Drawing.Color.FromArgb((int)pixel.Red, (int)pixel.Green, (int)pixel.Blue);
2-从中间体构建Hsv。
2- Constructing Hsv from the intermediate.
Hsv hsvPixel = new Hsv(intermediate.GetHue(), intermediate.GetSaturation(), intermediate.GetBrightness());
干杯。
这篇关于如何在EmguCV中将Bgr像素转换为Hsv像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文