Fast Transient Imaging
A Python framework revolving around reconstruction of impulse responses from AMCW lidar measurements.
InputOutput Namespace Reference

Functions

def ArrayToFloatBuffer (Array)
 This function converts a NumPy array to a binary buffer of single precision values, which can be processed by OpenEXR. More...
 
def FloatBufferToArray (Data, Shape)
 This function converts a binary buffer of single precision values as expected by OpenEXR to a NumPy array of given Shape. More...
 
def StoreImage (Image, FilePath)
 Stores an image to a file. More...
 
def LoadImage (FilePath)
 This function is the counterpart of StoreImage(). More...
 
def StoreScalarImage (ComplexOrRealImage, FilePath)
 This function creates a new image file containing the scalar values in the given array. More...
 
def LoadScalarImage (FilePath)
 This function loads an image file containing the scalar values of a two- dimensional array as produced by StoreScalarImage(). More...
 
def Unpack (Stream, StructFormat)
 Reads data from a stream using struct.unpack() and returns the resulting tuple. More...
 

Function Documentation

def InputOutput.ArrayToFloatBuffer (   Array)

This function converts a NumPy array to a binary buffer of single precision values, which can be processed by OpenEXR.

def InputOutput.FloatBufferToArray (   Data,
  Shape 
)

This function converts a binary buffer of single precision values as expected by OpenEXR to a NumPy array of given Shape.

def InputOutput.StoreImage (   Image,
  FilePath 
)

Stores an image to a file.

It is a wrapper atop wrappers to support PIL image file formats OpenEXR (*.exr) and Matlab data files (*.mat).

Parameters
ImageA real array of shape (Height,Width,3) or (Height,Width). In the first case Image[Y,X,:] defines an RGB triple, in the latter case Image[Y,X] is repeated as brightness for all channels. When writing to PIL images the held values should lie between zero and one.
FilePathThe path to an OpenEXR file (*.exr), a Matlab data file (*.mat) or a file with a file format extension supported by PIL. This is where the output image is written to. If it exists already, it is overwritten without prompt. Written OpenEXR files are always single precision RGB images. Written Matlab data files contain a single variable named Image containing the given array.
Note
The function does not perform sRGB conversion. The given values are stored as is for all formats.
Exceptions
ImportErrorIf PIL or OpenEXR are needed, but not available.
See also
LoadImage()
def InputOutput.LoadImage (   FilePath)

This function is the counterpart of StoreImage().

It loads an image from a file and returns it.

Parameters
FilePathThe path to the image file. The choices are the same as for StoreImage().
Returns
An array of shape (Height,Width,3) with data type np.float.
Warning
The function is not guaranteed to behave correctly for images which have not been generated in the format produced by StoreImage().
def InputOutput.StoreScalarImage (   ComplexOrRealImage,
  FilePath 
)

This function creates a new image file containing the scalar values in the given array.

Parameters
ComplexOrRealImageA two-dimensional array containing scalar values. The values may be complex or real.
FilePathThe path to the image file that is to be created. See StoreImage() for details. The file uses single precision and RGB channels. The red channel contains the real part of the provided values. The green channel contains the imaginary part (if present). Other channels have value zero. To avoid loss of data it is recommended to use OpenEXR files (*.exr) or Matlab data files (*.mat).
def InputOutput.LoadScalarImage (   FilePath)

This function loads an image file containing the scalar values of a two- dimensional array as produced by StoreScalarImage().

Parameters
FilePathThe path to an image file as produced by StoreScalarImage().
Returns
A two-dimensional np.ndarray as expected by StoreScalarImage().
def InputOutput.Unpack (   Stream,
  StructFormat 
)

Reads data from a stream using struct.unpack() and returns the resulting tuple.

StructFormat is the format string passed to struct.unpack. As many bytes as needed for this format will be read from Stream.