Light Field Toolbox: Version 0.2 adds Camera Calibration, Multiple Camera Support and more

Light Field Toolbox: Version 0.2 adds Camera Calibration, Multiple Camera Support and more Light Field Toolbox, Donald Dansereau’s set of tools for light field image processing in Matlab, is now available in version 0.2. New features include camera calibration, image rectification, and convenience functions for managing multiple light fields and multiple cameras.

  Light Field Toolbox v0.2 (1.9 MiB, 2,275 hits)

Official changelog:

– Calibration of lenselet cameras from checkerboard images
– LFUtilDecodeLytroFolder: decoding, colour correction and rectification
– Management of multiple cameras, white images and calibrations
– Organized code into a folder structure, see LFMatlabPathSetup
– Organized light fields / cameras into a folder structure
– Code and usability improvements throughout

Because some functions have been replaced and parameters have been renamed, code written with v0.1 may require modification to work with v0.2.

Along with the update, there’s a new light field sample pack which introduces a folder structure optimized for use with multiple cameras, and a small sample calibration dataset.

  Light Field Sample Pack 1 (rev. 2) for LightField Toolbox v0.2 (72.8 MiB, 1,617 hits)

  Sample calibration file for Light Field Toolbox v0.2 (70.1 MiB, 1,566 hits)

Additional calibration datasets are available in the downloads section of the ACFR Marine Systems website. According to the entry, “Datasets A and B are good example datasets for calibrating a Lytro-like camera, in that they feature dense grids imaged at close range and over a diverse variety of poses.”

Details and more information can be found at the MATLAB Central project page and the ACFR Marine Systems website.

Updated function reference:

Decoding / Input

  • LFBuildLenseletGridModel
    Function for building a lenselet grid model from a white image. Called by LFUtilProcessWhiteImages.
  • LFDecodeLenseletImageSimple
    Decodes a 2D lenselet image to a 4D light field using a white image for devignetting and a lenselet grid model build from the white image. See example usage in LFDecodeLytroImage.
  • LFDecodeLytroImage
    An example of using LFDecodeLenseletImageSimple to decode Lytro imagery. Can be called directly to decode a single image into memory, or called indirectly through LFUtilDecodeLytroFolder.
  • LFSelectFromDatabase
    Selects the white image or calibration file appropriate for a given serial number, zoom and focus setting. Used to select white images and calibration info files, as demonstrated in LFUtilDecodeLytroFolder and LFDecodeLytroImage.
  • LFUtilDecodeLytroFolder
    Utility for decoding, colour correcting and rectifying Lytro imagery. Can process multiple light fields; recursively searches folder structures; accepts filename specifications including wildcards. Automatically selects appropriate white images and calibration files from multiple cameras across multiple zoom and focus settings. Will incrementally apply operations to files so that, for example, previously-decoded light fields can be incrementally colour-corrected, rectified or both without needing to repeat operations. Results are saved to disk. See Figs. 2, 3 and 6 for example output.
    Demonstrates LFDecodeLytroImage, LFDecodeLenseletImageSimple, LFSelectFromDatabase, LFColourCorrect, LFHistEqualize, and LFCalRectifyLF.
    Decoding relies on a white image database having been constructed by LFUtilProcessWhiteImages, and rectification similarly relies on a calibration database having been created by LFUtilProcessCalibrations.
  • LFUtilProcessWhiteImages
    Processes a folder populated with white images, generating a grid model (.grid.mat) for each, and a white image database (WhiteFileDatabase.mat) used to select the white image appropriate to a light field. Dark images are
    automatically detected and skipped.

Image Adjustment

  • LFColourCorrect
    Applies a colour balance vector, an RGB colour correction matrix, and gamma correction. Usage is demonstrated in LFUtilDecodeLytroFolder.
  • LFHistEqualize
    Adjusts the brightness of a light field based on histogram equalization. Capable of handling colour and monochrome images. Capable of handling different input dimensionalities including 2D images and 4D light fields. If a weight
    channel is present as a fourth colour channel, it is used to ignore zero-weight pixels. Usage is demonstrated in LFUtilDecodeLytroFolder.


  • LFDispMousePan
    Display 2D slices of the light field with a rudimentary parallax effect. Click and drag in the image to change the point of view. An optional parameter controls the display size. Note that darkening at the edges of unfiltered light
    fields mean that the effect is best near the center of the spatial range. For an automatically animated display, see LFDispVidCirc. The function re-uses previously-opened light field display windows. Note that changing display size requires that the display window be closed prior to calling this function.
  • LFDispVidCirc
    Animated display showing 2D slices of the light field, similar to LFDispMousePan except the motion is preset to a circular path. Optional parameters include the radius of the circular path, animation speed, and display size.

You may also like...

1 Response

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.