openexr-user
[Top][All Lists]
Advanced

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

[Openexr-user] How to load a HDR image to 3 float R, G, B images?


From: JIA Pei
Subject: [Openexr-user] How to load a HDR image to 3 float R, G, B images?
Date: Tue, 24 May 2011 18:01:48 -0700



Hi, all:

1) I checked hdrread in Matlab 2010b, which seems to have ignored exposure time, the code is as follows:

% The formula for transforming (Rm,Gm,Bm,E) into (Rw,Gw,Bw) is given by
% ((Rm + 0.5) / 256) * 2^(E - 128)
rgb = ((single(rgbe(:, 1:3)) + 0.5) ./ 256) .* ...
      repmat(2 .^ (single(rgbe(:,4)) - 128), [1,3]);


2) However, what's suggested on softimage http://softimage.wiki.softimage.com/index.php/Converting_Radiance_HDR_to_Float_RGB is:
unsigned char hdr_r, hdr_g, hdr_b, hdr_e;

// -- read hdr_r, hdr_g, hdr_b, hdr_e from the image as unsigned chars.

// Convert the 8-bit HDR RGBE components to RGB float.
float r, g, b, e;

e = ldexp( 1.0f, hdr_e - (int)(128+8) );
r = hdr_r * e;
g = hdr_g * e;
b = hdr_b * e;
which seems to be a little bit different from the above. Still, it doesn't consider the exposure time.


3) What's in FastHDR http://code.google.com/p/realtimehdrimageprocessing/ considers exposure time, but it's a bit more different from the above two decoding methods:
int ee = javaSignedByteToInt(e) - 128 + 8;
    double f = Math.pow(2, ee) * WHITE_EFFICACY / exposure;

    rgb[0] = (double)(javaSignedByteToInt(r) * f);
    rgb[1] = (double)(javaSignedByteToInt(g) * f);
    rgb[2] = (double)(javaSignedByteToInt(b) * f);

in which
javaSignedByteToInt(e) - 128
is just hdr_e because in Java, there is no "unsigned" staff.

Where is a documentation to standardize HDR decoding? Well, all the above 3 methods are more or less similar indeed.


Best Regards

--

Pei JIA

Email: address@hidden
cell:    +1 778-318-5816

Welcome to Vision Open
http://www.visionopen.com

reply via email to

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