YUV color space and chrominance
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 conv开发者_高级运维ert 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?
Converting a monochrome image from RGB to YUV is very simple:
Y = R
U = 0
V = 0
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 simply 1 * 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 the Graphics.FromImage
method to create a Graphics
object for it, then use the DrawLine
method to draw lines.
To draw pixels, use the SetPixel
method of the Bitmap
object.
精彩评论