ISET / iset3d-v3

LEGACY: Replaced by iset3d (v4) -- Read a PBRT file. Edit the parameters. Render an ISET scene or optical image.
MIT License
36 stars 8 forks source link

Luminance calculation process involved with V-lambda curve twice? #40

Open J6rry opened 3 years ago

J6rry commented 3 years ago

I run the first introduction demo, and found that the luminance of the sphere scene is calculated from energy, which is rendered by pbrt. However, the raw energy data is convert to phtons imediately, whereafter, all the energy data is convert from "photons" data. As photons data has already been converted to "human eye response" with the V-lambda curve, so it cannot be used to convert to the "original" energy data. Am I correct?

Below is the related code in piDat2ISET.m file:

        if(scaleIlluminance)
            % In this case we cannot scale by the area because the aperture
            % is a pinhole.  The ieObject is a scene.  So we use the mean
            % luminance parameter (default is 100 cd/m2).
            ieObject = sceneAdjustLuminance(ieObject,meanLuminance); %already change photons data with V-curve
            ieObject = sceneSet(ieObject,'luminance',sceneCalculateLuminance(ieObject)); % used the changed photons data to convert to energy, then muliply with V-curve again?
        end
wandell commented 3 years ago

Thank you for your comment. We are always grateful when people think about the code and offer us suggestions. I hope you find the ISET3d and ISETCam methods useful.

What would be most helpful for this question is this. Please check whether the code is performing as intended. The function sceneAdjustLuminance(), which you ask about, is supposed to take in a scene spectral radiance and return it after multiplying by a single scale factor so that the returned scene radiance (in ieObject) matches the meanLuminance parameter.

Does that fail? If so, please insert a code snippet showing the failure.

The function sceneCalculateLuminance does something a little different - it calculates the point by point luminance for the image. It would be very nice if you wrote a test to see whether that code is also working correctly, and if not then let us look into it.

Again, we very much appreciate suggestions. They are most helpful when accompanied by short code snippets that demonstrate there is a problem - or a new and interesting use case. Thinking there might be a problem from reading the code, and asking us to follow your thinking, is more time-consuming and potentially error prone because language is less precise than checking the code.