YUV色彩空间和色度
好的。简而言之,假设:
我有一个单色图像;最初它以 RGB 颜色空间表示。
我不知道应该按什么顺序执行此操作,但我需要将图像转换为 YUV 空间 (a) 并将其加载到
PictureBox
控件 (b) 中并进行一些颜色涂鸦;最后我需要以某种方式学习/知道哪些像素被着色。
如何在
PictureBox
中加载的图像上绘制线条/点?
有什么想法吗?
Ok. To be short suppose:
I have a monochrome image; And initially it represented in RGB color space.
I don't know in what sequence I shall do this, but I need to convert image to YUV space (a) and load it into
PictureBox
control (b) and make few color scribbles;And finally I need to learn/know somehow what pixels were colored.
And how do I draw lines/dots on loaded image in
PictureBox
?
Have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将单色图像从 RGB 转换为 YUV 非常简单:
Y 是亮度,计算公式为
0.299 * R + 0.587 * G + 0.114 * B
,但对于单色图像,R = G = B,它与(0.299+0.587+0.114) * R
相同,即1 * R
。U 的计算公式为
0.436 * ((B - Y) / 0.886)
,但当 Y = B 时,它始终为零。V 的计算公式为
0.615 * ((R - Y) / 0.701)
,但当 Y = R 时,它始终为零。要在
Bitmap
对象上绘制线条,请使用Graphics.FromImage
方法为其创建一个Graphics
对象,然后使用DrawLine
方法来绘制线条。要绘制像素,请使用
Bitmap
对象的SetPixel
方法。Converting a monochrome image from RGB to YUV is very simple:
Y is the luminance, calculated as
0.299 * R + 0.587 * G + 0.114 * B
, but as R = G = B for a monochome image, it's the same as(0.299+0.587+0.114) * R
which is simply1 * R
.U is calculated as
0.436 * ((B - Y) / 0.886)
, but as Y = B it is always zero.V is calculated as
0.615 * ((R - Y) / 0.701)
, but as Y = R it is alwaus zero.To draw lines on a
Bitmap
object, you use theGraphics.FromImage
method to create aGraphics
object for it, then use theDrawLine
method to draw lines.To draw pixels, use the
SetPixel
method of theBitmap
object.