dimanche 26 avril 2015

converting greyscale image from RGB to YUV gives non-zero U and V

I've read that if image is greyscale then it shouldn't have B and R component in RGB and no U and V in YUV color spaces. Does it mean they should be equal to 0?

I'm using this code to get YUV values:

var px = (this.canvas.Image as Bitmap).GetPixel(i, j);

var y = 0.299 * px.R + 0.587 * px.G + 0.114 * px.B;
var u = -0.14713 * px.R - 0.28886 * px.G + 0.436 * px.B;
var v = 0.615 * px.R - 0.51499 * px.G - 0.10001 * px.B;

And I'm getting non-zero u and v values, though they're are close to 0. Should I convert them to int anyway? Was the image really greyscale?

Aucun commentaire:

Enregistrer un commentaire