Skip to content

Scene radiance

David Cardinal edited this page Oct 30, 2021 · 45 revisions

Code overview

We have collected and posted online tutorials and scripts that illustrate how to create scenes


Creating simple scenes

scene = sceneCreate;
scene = sceneCreate('slanted bar');

The ISETCam scene structure is a description of the scene spectral radiance. The scene structure includes the parameters necessary to describe the spectral radiance at sample points in the world. Each point is at a different distance. The model is simplified because each point is assumed to emit light uniformly in all of the directions that reach the camera aperture. (For a discussion of the full scene description, see this page about the light field.)

We store the spectral radiance of each point in the scene structure using units of quanta/sec/sr/nm/m^2 (scene.data.photons). In almost all cases we further store the spectral radiance distribution of the light source. In some cases we store a space-varying representation of the illuminant spectral radiance distribution. In general cases we store the depth map as well - the distance from the observer to each point in the scene (scene.depthMap), or the distance from the observer to the central point in a planar scene (scene.distance).

This level of scene representation is useful for many calculations. For example, a scene whose points are all far away, or a planar scene of a test chart can be well-represented this way. These approximations suffice for many simple but important scenes used in image quality metrics and camera evaluation. Many users never need more than this basic structure.

Creating 3D scenes

A more complete and accurate representation of a 3D scene describes all the rays arriving at the camera aperture. At every point in the aperture we represent the intensity and direction of the incident rays (light field). For simulations that account for the light field, ISETCam uses graphics rendering methods ISET3d toolbox. This toolbox traces rays from the scene through a model of the camera optics. The ISET3d calculations account for multi-element optics and diffraction. The rendering accounts for occlusions and depth of field depth (bokeh) effects.

The ISET3d methods are constantly being expanded. At present they account for various types of bidirectional reflectance distribution functions, transparency and even retroreflective materials. We recently added fluorescence modeling. The ISET3d package also simulates light field cameras with microlens arrays. When using ISET3d with a lens model, we return an optical image.

A special case arises when we use ISET3d with a pinhole model of the camera and diffraction turned off. In that case the iset3d code returns a scene structure.

Basic scene functions

Like other ISETCam structures, the scene has these basic methods

  • sceneCreate - Method that produces many different types of scenes for testing
  • sceneSet - Set scene parameters (e.g., field of view, or mean luminance)
  • sceneGet - Get scene parameters
  • scenePlot - Plot scene functions and parameters
  • sceneWindow - Open up the scene graphical user interface (GUI), which can hold a collection of scenes

More information about the scene parameters and programming with scenes can be found in the scene programming wiki pages, and in the scene Scripts and tutorials.

sceneFromFile

In addition to the many test functions implemented in sceneCreate, the ISETCam function sceneFromFile can read an RGB image and return a scene radiance structure. This enables you to test camera features using almost any image as an input to the simulation.

The scene returned from an RGB image is not a physically-precise description of the scene; it is just a useful way to produce a rough approximation. The algorithm implemented in sceneFromFile creates the scene spectral radiance that one would measure if (a) the RGB data are displayed on a monitor, and (b) the scene illumination is the monitor white point. Hence, factors that depend on the true scene spectral radiance or on depth will not be properly represented in the scene. Spatial patterns, light levels, and related effects will be represented.

Here is the sceneFromFile code in action.

d = displayCreate('LCD-Apple');
meanLuminance = 100;
scene = sceneFromFile('eagle.jpg','rgb',meanLuminance,d);
ieAddObject(scene); sceneWindow;

Notice that the scene depends on the display model, and these can differ substantially. Here is a comparison between two different displays.

d = displayCreate('LCD-Apple'); meanLuminance = 100;
scene = sceneFromFile('eagle.jpg','rgb',meanLuminance,d);
rgb1 = sceneGet(scene,'rgb'); imshow(rgb1);

d = displayCreate('CRT-Dell');
scene = sceneFromFile('eagle.jpg','rgb',meanLuminance,d);
rgb2 = sceneGet(scene,'rgb'); imshow(rgb2);

Clone this wiki locally