Ask Your Question

How to calculate the YUV values of a grayscale image ?

asked 2015-03-10 11:38:05 -0600

begueradj gravatar image

Is it possible to calculate the values YUV of a graycale image ?

I found an article that confuses me: Interactive Image Colorization and Recoloring based on Coupled Map Lattices In which the authors propose an algorithm to color and recolor an image.

First they color grayscale images. The user scribble some regions of the image with the desired color which spreads itself automatically by the algorithm. They use YUV color space to compare the values of Y between the current pixel and its neighbors. If the Y value of a neighbor is stronger than the current pixel sets its U and V values to those of the neighbor (attacker).

My problem: how can I cancluate the YUV values of a given pixel of a grayscale image ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-10 12:12:46 -0600

Engin gravatar image

An YUV image is composed of three channels: luminance/luma (Y/Y'), chroma blue (U), chroma red (V).

If your image is in YUV space and appears grayscale, it has no blue and red components, only luminance, zero blue and red components. Or if your image is in RGB space and grayscale, its R, G and B values are not too diverse, e.g. (R,G,B) = (120,115,123).

Conversion is done by:

image description

edit flag offensive delete link more


is the Y of the a grayscale image the same one as in an image of YUV color space ?

begueradj gravatar imagebegueradj ( 2015-03-10 12:26:07 -0600 )edit

Yes it is.

Engin gravatar imageEngin ( 2015-03-10 12:30:33 -0600 )edit

thank you very much

begueradj gravatar imagebegueradj ( 2015-03-10 12:32:53 -0600 )edit

You are welcome.

Engin gravatar imageEngin ( 2015-03-10 13:47:16 -0600 )edit

Question Tools

1 follower


Asked: 2015-03-10 11:38:05 -0600

Seen: 7,310 times

Last updated: Mar 10 '15