From: Marcel J. <ko...@ho...> - 2007-08-02 06:01:25
|
On Wednesday 01 August 2007, Bob van Loosen wrote: > So after the YUV to RGB conversion, I have to apply a gamma of 2.2 to > get linear output, is this correct? Your screen is not linear with respect to RGB (grey) levels. The screen shows a gamma curve of 2.2 when you apply linear grey scales. This means that when a picture is shown which has been encode with a gamma of 0.45 it will show correctly on your screen. In other words, if you direct the output from the video to your LEDs, you should apply a gamma of 2.2 on the LED curves. The trick is to make both respond equal. This also should be applied to colour (see below). This gamma correction should have quite a large impact on your system already I think. > This still leaves the problem of a proper YUV to RGB conversion, > because I still have the problem of the dark gray showing up as green. > I would really like to use xine's own yuv2rgb functions, however I can't > figure out how to use them. > I could implement the ambilight in one of the video output modules, > since the conversion is already done there. This conversion is fine but it's not the complete conversion you should do I believe. When transforming YUV to RGB, you get RGB values of the video (the actual movie or image). This does not represent the R,G,B colour of your screen or LED's but just the intensity levels of these colours. They are only correct if the screen white point is as was intended by the video material. For this purpose many people like to calibrate their monitor/TV/projector so that the colour in the video is shown correctly on the screen (and not blueish or greenish). R,G and B of the screen and LED's are also different in colour. You can see that by showing full a colour on your screen and look at what should be the same colour for your LED's. I think you will see some difference. Also, if you have 2 monitors and put them next to each other you will see notable differences in colour (often even when they are same brand and model). This means that to get equal colour you should calibrate them to be equal. If you take the CIE colour triangle for example (http://en.wikipedia.org/wiki/CIE_1931_color_space) and mark 3 dots for R,G and B for your screen and mark 3 different dots for your LED's you will find 2 triangles within this CIE chromaticity diagram. Within these 2 triangles you can match another triangle, which basically marks the area in which both your LED's and screen can produce equal colours. Ideally you would transform both your screen and your LED's to the new found triangle. Doing that means that colour points will shift a little to white and therefore become a little less saturated (that's the penalty). Getting back at the YUV conversion, the RGB values from this routine will produce a different white colour on your screen and your LEDs if they are not calibrated but are correct for the video material. RGB needs to be compensated for your screen and your LEDs. To transform, you will need a matrix. This matrix is usually calculated using CIE 1931 x,y (or XYZ) from the R,G and B points and their white point (XYZ). The catch is that you should know these x,y points. Since you can't measure them, you can try to find the values in the specifications. For most monitors you can find the values in the monitor profile, for your TV maybe in the TV specification. For the LED's you may find them from the spec as well. Note that these values are not entirely correct (mostly the spec contains a range). There is some good reading material on this matter on the web. Look for white balancing for example and you will find quite a lot of articles on it. Some info that may be a good read : http://www.brucelindbloom.com/index.html?ColorCheckerRGB.html http://en.wikipedia.org/wiki/White_balance regards, Marcel |