openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openexr-devel] Reconstruct red and blue channel from BY RY channels


From: Hồ Châu
Subject: [Openexr-devel] Reconstruct red and blue channel from BY RY channels
Date: Wed, 15 May 2013 01:43:49 -0700 (PDT)

Hi guys!

I have problem with change luminance/chroma to RGB, always get purple image from Flowers.exr and comp_b44.exr test files. I try understand how this algorithm works, create own version for seeing if I understand it correctly (detail below). Image quality is good but after reconstructed red and blue channels too bright, value range is different from same channels from comp_no.exr file. I think maybe need use fixSaturation() function but that function fixes all three channels together. Any one ever have this problem?

Because file have no chromacities attribute, I use these values:
red = {0.64, 0.33}
green = {0.3, 0.6}
blue = {0.15, 0.06}
white = {0.3127, 0.329}

and calculate Yw values with computeYw() function:
Yw = {0.212639, 0.715169, 0.0721923}   (x, y, z)

Then convert reconstructed pixels with this formula:
red = luminace*(reconstuct_red + 1);
blue = luminance*(reconstuct_blue + 1);
green = (luminance - red * Yw_x - blue * Yw_z) / Yw_y;

Below shows details how I reconstruct red and blue channels, if I do this wrong please tell me.

Read file (Flowers.exr or comp_b44), have this three channels with size:
2n x 2m luminance Y channel
n x m  BY channel
n x m  RY channel

Reconstruct BY and RY channels
1. copy first and last pixel of each scan line, column 0 to 12 value of first pixel, column 13 to 13 + (n - 1), data for scan line, 13 + n to 26 + n - 1 copy value of last pixel for each scan line

+------+-------------+-----+
| copy |             |copy | 
|first |    chroma   |last | 
|pixel |    data     |pixel|
|data  |             |data |
+------+-------------+-----+

2. Expand horizontal scan lines use formula from reconstructChromaHorz() function for odd pixel values, copy even pixels and put data in 2n x 2m buffer:
+----------------------------------+
| 13 lines, space copy first line  |
+----------------------------------+
|                                  |
| reconstructed scan lines         |
|   (2n x m)                       |
+----------------------------------+
| 13 lines, space copy last line   |
+----------------------------------+

After reconstructChromaHorz, copy first scan line for row 0 to 12, copy last scan line for row 13 + n to 26 + (n-1).

3. Use formula from reconstructChromaVert() function for odd scan lines, copy even scan lines and put in final buffer 2n x 2m.

Is this correct method for reconstruct RGB data? thanks for any help.

Châu


reply via email to

[Prev in Thread] Current Thread [Next in Thread]