 # Obtain radiometric values from OpenEXR channels

Good morning everybody! I created a physically accurate scene and my aim is to study radiometric conditions over the rendered scene in order to obtain an illumination map in terms of [W/m^2]. I saved images in OpenEXR file format, due to its high dynamic-range properties and I wanted to obtain a Relative Luminance Map starting from RGB values in “R” “G” “B” channels. The major issue is how to scale linear values from OpenEXR channels to have physically accurate values between [0, 1], needed to obtain Relative Luminance map maintaining the HDR properties of the file format. Part of the code is reported below.

``````    pt = Imath.PixelType(Imath.PixelType.FLOAT)
exrfile = exr.InputFile(filename)
size = (dw.max.x - dw.min.x + 1, dw.max.y - dw.min.y + 1)
redstr = exrfile.channel('R', pt)
red = np.fromstring(redstr, dtype = np.float32)
red.shape = (size, size) # Numpy arrays are (row, col)

greenstr = exrfile.channel('G', pt)
green = np.fromstring(greenstr, dtype = np.float32)
green.shape = (size, size) # Numpy arrays are (row, col)

bluestr = exrfile.channel('B', pt)
blue = np.fromstring(bluestr, dtype = np.float32)
blue.shape = (size, size) # Numpy arrays are (row, col)

rel_luminance = 0.2126*red[:,:]+0.7152*green[:,:]+0.0722*blue[:,:]
``````

For a test image the obtained Max values of the three channels are respectively:

Max(R) = 198.16421508789062

Max(G) = 173.5792999267578

Max(B) = 163.20120239257812

The obtained values are obviously not in the range between [0, 1], moreover I am not able to understand the global maximum value to scale the channels and obtain what i want.

Has someone some tips to solve my problem? Thanks in advance.

why not make a scene with a simple emitter, or several - at different known luminosities, render it out, read out the values and use it as reference to obtain scale values?
I remember vaguely in the new sky texture thread, there was some discussion going on about scaled values - and what blenders light multiplier of 1.0 means in real world values… you might find something there too: New Sky Texture

EDIT: found it: New Sky Texture - #310 by nacioss

1 Like