ActionPhotos by Marianne

Home -> Tech Info -> Optical Simulation

Optical Simulation

Update, Vcam Ver. 1.50:   Adds switches /Z, /N, /G, /E and /J to provide more options for the raw-file image patch output. See descriptions below. As a convenience, frequently-used switches may be placed into file Vcam_sw.txt, which is scanned before the command-line switches are parsed; the command line switches have priority. Switch /Q is added, to alter the spectral distribution of light assumed for generating the diffraction contour. It is no longer necessary to use the /L switch to enable the analysis parameter output, or the image patch output to Output.NEF.

For reasons of size, the template raw file has been placed into a separate archive. The earlier simulation application, Conv2, is no longer supported since Vcam includes all of its features.

New Product Introduction, Vcam Ver. 1.00:   A Virtual Camera, based on Conv2 ver. 1.24, this application adds image output to file Output.NEF, when a .NEF file of that name is present and the test object is a periodic signal that spans the full workspace. Supports all Conv2 features and switches; new switches /X and /Y are added. NEF format must be 14-bit uncompressed; a template version is included in the archive. By default, the output image patch is approximately 400x100 pixels for pre-AA or post-AA output only, or 400x200 pixels when both output options are enabled. The image patch consists of the sensel values normally output by the /L switch, shifted across all offsets to create vertical lines with a slight slant (40:1). The purpose of the image patch is to allow the user to evaluate end-to-end performance of the entire photographic process from test subject to converter output, assess raw-converter performance, and test the effects of converter settings on the quality of the converter's image rendering.

Overview and Features

The Optical Simulation tool presented here is designed to answer questions related to resolution, diffraction, AA filter effects, lens quality, and how our cameras "see" the smallest details. For example: What does diffraction look like? How does the AA (anti-aliasing) filter affect an image? Should I select a camera with or without an AA filter? Can diffraction substitute for the function of an AA filter? How does lens quality, focus precision and lens aperture affect the resolution my camera can achieve? When will moire' (aliasing) show up? How do optical imperfections combine to limit resolution? How do different test-objects compare for evaluating lenses and cameras? When is my lens diffraction-limited? How strong is my camera's AA filter?

The simulation tool, Vcam.exe, starts with one of several basic object patterns, then applies defocus, diffraction, lens point-spread and/or AA filtering as specified by the user. The resulting image is presented in a .bmp file for viewing (both pre-AA-filter and post-AA-filter versions), and numerical output is available to show how the camera's sensor responds to the image, or as a "dump" of the image centerline values. The sensor-response output reveals camera resolution and sensitivity to moire', while the image dump allows detailed study of the image presented to the sensor.

Calculations are carried out by dividing the image space into samples which correspond to 1/20th of the width of a single sensor element (sensel). Thus the area occupied by one sensel is represented by 400 computing samples. The digital workspace is 1001 samples wide by 301 samples high, or 50x15 sensels. Spatial parameters such as AA-filter shift and object feature size are adjustable in units of 1/20th of a sensel width. Other parameters such as lens PSF diameter and COC diameter may be specified as any value, but will be quantized to 1/20th-sensel units for computing purposes. The coordinate system origin is placed at the center of the workspace, and test objects (unless offset) are centered at this origin.

By default, diffraction contours are computed for the distribution of wavelengths detected by a typical camera green channel (specifically, weighting is taken from the Nikon D3 green-channel response curve with Halogen illuminant). This allows the simulation to accurately model RAW data from the camera sensor's green channel, which is normally selected for various types of image analysis. Other spectral distributions may be specified; see the /Q switch description below.

Image output is written to the file Output.bmp. If AA-filter shift is non-zero, this will include two 1001x301 image panes, with the upper image representing the post-AA-filter result and the lower image showing the pre-AA-filter result. Subsequent runs of Vcam.exe will overwrite Output.bmp, so this file should be re-named if the user desires to preserve it. Since the 8-bit output image is limited to representing values up to 255 only, the image values are auto-rescaled to this range, in cases where highlight clipping would otherwise occur. To improve visibility of faint areas, upscaling up to 2 stops is provided for low-amplitude images.

Numerical data output, and the setup parameters, are appended to file Trace.csv, which then acts to accumulate information from consecutive runs. Numerical data is never re-scaled.

Numerical Analysis:  In cases where a periodic test object is specified and that object spans the full width of the output image, a raw-data image patch is written to file Output.NEF, if it exists, and additional parameters are computed:

H(f): This is the signal transfer function, and specifies what fraction of the input signal appears at the output; the range is 0 to 1 nominally, but can be higher if sharpening is used. There are three frequency ranges in which this parameter is evaluated differently: 1) For signals below Nyquist frequency, H(f) represents the average MTF over an infinite span; 2) For signals exactly at Nyquist frequency, i.e. when T=2, H(f) will vary with offset (phase shift between signal and sensel position), and at the default zero-offset its value will be doubled (use the -O switch to investigate dependency on offset); 3) For signals above Nyquist frequency, H(f) is zero since these signals cannot be represented.

Note:  H(f) and the other parameters are evaluated across an interval which corresponds exactly to an integer number of beat cycles between the signal frequency and sampling frequency (1/sensel pitch). This provides accurate values which are representative of the averages which would be measured for signals of infinite span. However, with long signal periods, there are some values of T where the beat cycle would not fit within the extended workspace. In these cases, T will be adjusted downward slightly so that the resulting beat period may be accommodated.

Xchroma: This represents the degree of cross-chroma, also known as color moire', caused by aliasing. This artifact of aliasing is one of the most noticeable in images, producing false yellow and cyan edges with Bayer RGB sensors. Range is 0 to 1, with 0 representing no cross-chroma, and 1 indicating the heaviest level. The sophisticated demosaicking algorithms used by modern raw converters will attenuate most of the cross-chroma in areas where textures are fairly uniform, but may have difficulty where very fine textures change abruptly.

Alias: This is the effective amplitude of signals present at frequencies below the signal frequency, which are a product of aliasing. When the input frequency is above Nyquist, i.e. when the switch -T parameter is less than 2, Alias substitutes for H(f) to give the magnitude of the output.

Moire: The envelope of the output data is analyzed to find the level of amplitude modulation, known as moire, caused by superposition of aliased signals. A value of 0 indicates no moire, while a value of 1 indicates moire of maximum modulation. In images, moire below 0.1 would appear as slight, 0.2 to 0.3 is very noticeable, and 0.5 or higher is heavy. Visibility of moire is also affected by the beat frequency, and is most noticeable at low beat frequencies where the moire cycles are wide.

The application Vcam.exe is a console application, which is run from a Windows Command Prompt window, and is controlled by command-line switches. A switch is a single letter prefixed by a hyphen '-' or forward slash '/' or alternatively, switches with a parameter value may omit the prefix and use an equals sign '=' suffix before the parameter value. Spaces separate switches, so embedded spaces are not permitted except where required (/J, /K and /Q switches, which have two parameters). Recognized switches are:



Last Update:  Jan. 29, 2013.