How to simulate high resolution images

This article describes how to use the Image Simulation analysis tool to produce photorealistic images of object scenes including the effects of diffraction, aberrations, distortion, relative illumination, image orientation and polarization.

Authored By Mark Nicholson


OpticStudio supports an Image Simulation feature that quickly and accurately predicts the appearance of any scene as imaged by the optical system. The method works by convolving a source bitmap file with an array of Point Spread Functions. The effects considered include diffraction, aberrations, distortion, relative illumination, image orientation, and polarization. This feature is very fast, fully multi-threaded to operate over all the CPUs in your computer and gives excellent signal/noise in the final image.

Introduction to Image Simulation

We will begin our discussion of Image Simulation by opening a sample file provided with OpticStudio in the Zemax sample files folder. Please open the file {Zemax}\Samples\Sequential\Image Simulation/Example 1, a singlet eyepiece.zmx. In the Image Simulation 2 window, open the Settings

Image simulation

Image Simulation requires that the user specify a source file, which can be a BMP, JPG, IMA, or BIM. This file is read into OpticStudio, and its full height must be defined in field units using the Field Height setting. Note that because this feature references the field units for the system, it is usually best to convert the system to use Field Type: Object Height. In this case, the field height is 13.8 mm. The input scene can also be rotated, flipped, resampled as necessary, and then centered on any field point.

Source bitmap

When we run the Image Simulation, it will compute a grid of point spread functions (PSFs) across the input scene. The grid spans the entire field and describes the aberrations at selected points in the field of view, as defined by the bitmap and field size settings. The PSF grid also includes the effects of polarization and relative illumination. You can see this PSF grid in the Image Simulation 1 window in the sample file. In this case the central PSF is very well formed, but as we move away from the axial field, the PSFs become considerably aberrated. In particular, we can easily see the coma present in the corners of the PSF grid.


In order to reconstruct the entire simulated image, OpticStudio uses the interpolates the PSF grid for every pixel in the modified source bitmap. That is, for each pixel, an effective PSF is interpolated between the nearest PSF points in the grid. That PSF is then convolved with the modified source bitmap to determine the aberrated bitmap image. The resulting image is then scaled and stretched to account for the detected image pixel size, geometric distortion, and lateral color aberrations.

Diffraction aberrations

Setting up Image Simulation

In most cases, the default settings chosen by OpticStudio give usable results with little user intervention. However, it’s always best to really understand what the calculation is doing! In this section, we will walk through the Image Simulation calculation step by step. Before we get started, open a new Image Simulation window. 

  1. First, you must choose your input scene. In the Image Simulation Settings, select Input File: Demo picture - 640 x 480.bmp.
  2. Then, we will define and propagate a single, on-axis PSF through the lens system. This will make the PSF grid a single delta function. Any function convolved with a delta function yields the initial function, so the resulting simulated image will be exactly the same as the input scene, except it will suffer the distortion of the optical system. Under the Convolution Grid Settings choose Aberrations: None and set the PSF-X Points and PSF-Y Points to 1 in each case. Setting up the Image Simulation Analysis
  3. We can then view distorted image. Set Show AsSimulated Image. Ensure that Pixel Size, X-Pixels and Y-Pixels are all set to the default value of zero. with the default values. Doing this will set the number of pixels in the detector equal to the number of pixels in the source bitmap, and set the size of the detector pixels equal to the size of the central pixel in the source bitmap, as magnified through the optical system. This should yield a useful "baseline" system. Using the Reference setting, you can set the detector to be centered on the chief ray or surface vertex. This will shift the detector location so that it automatically moves as the input scene moves around the field of view, or remains fixed to the image surface vertex, respectively. Take the time now to set up the detector the way you want it before proceeding on.
  4. Once the detector is set up correctly, it is time to set up the PSF grid. Set Show As: PSF Grid, and set Aberrations: Geometric. If the RMS Spot Radius is much larger than the Airy disc everywhere in the field of view, use Geometric. If the spot radius is close to (or less than) the Airy radius, select Diffraction. Use the Diffraction setting also if the lens is diffraction limited over some part of the field of view but not diffraction limited elsewhere; doing this will allow OpticStudio to automatically switch to use Geometric at those points in the grid where the PSF is more than 20 times the diffraction limit.
  5. Next, we must set the appropriate number of PSF-X Points and PSF-Y Points for the grid. As with any sampling control, the number of PSF-X Points and PSF-Y Points is correct when there is little change between results when adjusting the values. Take some time to play with the number of points and see how the Simulated Image changes. In the end, set PSF-X Points: 7 and PSF-Y Points: 7. Remember that OpticStudio interpolates the PSF between the measured points, and the PSF Grid has the same size and resolution of the source bitmap. If a PSF grid point appears to only span one pixel, then the point spread function is small compared to the source bitmap pixel size. In this case, the source bitmap could be oversampled, and you should reduce the sampling or source bitmap height in order to make the PSF grid large compared to the pixel size (i.e. it spans multiple pixels).
    PSF grid point     PSF grid point2
    Generally, if diffraction effects are important then the source bitmap pixels (after any oversampling, if necessary) should be comparable in size to the PSF. The PSF grid should be several pixels wide if diffraction or aberration effects are important.
  6. Once the PSF Grid is satisfactory, set Show As: Simulated Image to see the results of the convolution and the final simulated image!

Sample file use cases

OpticStudio ships with several sample files demonstrating the utility of Image Simulation. We recommend that you investigate these sample files prior to using the feature to familiarize yourself with its various applications. The supplied examples are located in the Zemax Samples folder, located at {Zemax}\Samples\Sequential\Image Simulation. The specific file names and descriptions of their contents are listed below. 

Example 1: A singlet eyepiece

This is a classic example of the use of this feature. This lens is an eyepiece, but the system is not afocal. Rather, it is focal with a virtual image formed -1000 mm away (giving one diopter of accommodation). The aberrations are so large that the relative illumination contribution cannot be computed. In this case, the relative illumination is set to be uniform everywhere.

A singlet eyepiece1

Note the statement in the text below the Simulated Image. Also note that the PSF grid may look as if some points are missing.

A singlet eyepiece2

This is simply the result of sub-sampling on the monitor's screen. The input scene is 640 x 480 pixels, as is the PSF grid. However, the PSF grid is being displayed as a smaller window. In this case the whole analysis window is only 550x460 pixels, and the PSF grid is within approximately two-thirds of this, meaning the PSF grid is sub-sampled. If the window is maximized (or at least set larger than the 640x480 pixels needed by the PSF grid) the whole grid can be seen.

Example 2: Double Gauss experimental arrangement

OpticStudio allows four definitions of the field of view: Field Angles, Object Height, and Real or Paraxial Image Height. All four are valid ways of defining the field of view, but for the purposes of this feature--simulating the image of a bitmap input scene--Object Height is the preferred field definition.

This Double Gauss was originally optimized with the object at infinity, and with angles as the field definition. However, if the bitmap image is used with field in degrees, then each pixel corresponds to some angular range: which is probably not what the experimental or test arrangement is. Worse, angular pixels are inherently anamorphic. An x-width of one degree, for example, is a different subtended angle if the y-angle is 80 degrees versus 10 degrees. If field angles are being used and the field of view is fairly wide (more than about 40 degrees in any direction) then great care should be taken in interpreting the results for an extended object.

This file shows the Double Gauss in a configuration similar to realistic testing conditions.

Double-Gauss in its likely test configuration

Here, an auxiliary collimating lens is used to image the test scene to infinity, and the infinity-focused Double Gauss forms the image of the test scene. In this case, a paraxial lens is used to represent the auxiliary collimating lens but could be replaced with a real lens design if required. The most important setting is that the test pattern has a defined spatial extent, so that each pixel represents the same patch of illuminating area as any other.

Similarly, Real Image Height should not be used as the field definition when evaluating image performance with Image Simulation, or when computing any kind of distortion. When using Real Image Height, OpticStudio iterates each chief ray trace to find the exact object space angle to hit the desired image coordinate. Because the desired image coordinate is always reached, the image height is linear with respect to the field coordinate. In other words, the iteration is implicitly removing the distortion. Instead, OpticStudio automatically changes the field type from Real Image Height to Paraxial Image Height for the purposes of Image Simulation and issues a message to that effect.

However, even Paraxial Image Height is not ideal, as any anamorphic magnification of the lens (if present) will be ignored. Remember that if fields are defined by image height, then the Field Type control determines the size of the object in image space, not object space. The Field Type is always in whatever units the fields are defined in! Object Height is the most natural field definition to use with Image Simulation (or Geometric Bitmap Image Analysis), as it defines the size of the input source bitmap unambiguously.

Example 3: A blue notch filter

OpticStudio can also account for the polarization properties of the optical system on image formation. In this case a source scene consisting of overlapped red, green and blue circles is imaged by a lens that contains a blue notch filter that rejects the blue light. The resulting image is formed without any blue component. Shown below are the Source Bitmap image, and the result of the Image Simulation Analysis.

Image Simulation Analysis     Image Simulation Analysis2

Example 4: A diffraction limited system

In this example, a low-resolution scene is imaged through a diffraction limited system (the Hubble Space Telescope). To ensure that the input pixels are of the order of the PSF, the input scene is oversampled 16x to produce this PSF grid.

a diffraction limited system

In this design the field of view is in angles, but the angular field of view is so small (0.001°) that the anamorphic issues discussed above are not relevant.

Example 5: Spatially varying resolution

The same Double Gauss experimental arrangement is used as in Example 2, but in this case the test pattern consists of grid lines of varying spatial frequencies and orientations. The input scene is shifted around in the field of view by changing the field number, and the detector is always located relative to the chief ray from the viewed reference point. The effect of the different contrast (MTF) in the sagittal and tangential directions can be easily seen, as can lateral color. Again, the windows should be maximized or at least be larger than the pixel resolution of the input scene (201 x 201 pixels).

a grid of lines     a grid of lines

Example 6: Tilted image plane

In this case the object and image planes are tilted to induce keystone distortion and focal plane blurring. In Configuration 1 there is no tilt, and the PSF grid is diffraction limited over the field of view. In Configuration 2 (use Ctrl+A to switch configurations) the tilt results in the system being well away from diffraction limited at the top and bottom of the field of view.

Tilted image plane

This results in the image being diffraction limited in the central x-scan but out of focus at the top and bottom.


Note that the PSF grid automatically switches to geometric for any field point where the PSF is more than 20x the diffraction limit, so that Image Simulation uses diffraction effects wherever they can be computed, and switches to a geometric calculation as and when needed.

Other image analysis features

OpticStudio also supports several other image analysis features under Extended Scene Analysis. A summary of these features is provided tonight. 

Image Simulation menu

  • Geometric Image Analysis: This analysis is limited to geometric (hence no diffraction) computations of relatively low-resolution IMA and BIM bitmaps. However, it can be calculated on any surface. Conversely, the convolution-based Image Simulation can only be computed on the Image surface. Also, as Geometric Image Analysis is ray-tracing based, it can be used to compute system efficiency and also multi-mode fiber coupling. The IMAE operand allows the system efficiency to be used as a target in the merit function. 
  • Geometric Bitmap Image Analysis: This analysis is very similar to Image Simulation in that BMP or JPG source bitmaps can be imaged through an optical system. Generally speaking, Image Simulation will give much higher signal-to-noise ratio images more quickly than Geometric Bitmap Image Analysis. With the latter, the signal/noise is proportional to SQRT(n), where n is the number of rays traced per pixel. Detecting under sampling in the PSF grid of Image Simulation is trickier. Badly sampled PSF grids almost always look like delta functions, which means that the convolution-based method may predict performance that is better than is achievable in reality if the PSF grid is not set up adequately. Geometric Bitmap Image Analysis provides a useful double-check on the predicted performance. It can also be computed on any surface, including surfaces far from focus.
  • Partially Coherent Image Analysis: If the incoherent imaging of a bitmap through a diffraction limited system is needed, Image Simulation is generally superior to this method. However Partially Coherent Image Analysis allows the coherence of the source illumination to be included. This is an important effect in photolithography systems in particular.
  • Extended Diffraction Image Analysis: This analysis allows for coherent imaging of extended source scenes, and also allows each pixel in the source bitmap to represent a delta function. This is useful for checking the imaging of extended scenes that consist of point sources like stars. For incoherent source scenes, Image Simulation should be used instead.


  1. Simulating image quality in OpticStudio


Was this article helpful?
4 out of 5 found this helpful



Please sign in to leave a comment.