5.7. Fringe Proj

Summary:

Algorithms used for fringe projection (phase shifting and Gray code)

Type:

Algorithm

License:

LGPL

Platforms:

Windows, Linux

Author:

C. Kohler, M. Gronle, ITO, University Stuttgart

5.7.1. Overview

This DLL contains several reconstruction algorithms for fringe projection.

These filters are defined in the plugin:

  1. calcCiMap()

  2. calcPhaseMap4()

  3. calcPhaseMapN()

  4. createXYMaps()

  5. genGraycodePattern()

  6. gray2DecLookup()

  7. unwrapPhaseGray()

5.7.2. Filters

Detailed overview about all defined filters:

itom.algorithms.calcCiMap(images, contThres, brightUpperLimit, darkLowerLimit, ciMap[, safetyFactor])

Calculate the indexmap for graycode image stack

Parameters
  • images (itom.dataObject) – Continous 3D-image stack (uint8 or uint16)

  • contThres (float) –

    Threshold for contrast. Only pixels with ((bright-dark) > contThres) will be considered

    Value range: [0, 65535], Default: 10

  • brightUpperLimit (float) –

    Pixels with bright image > brightUpperLimit will be set to invalid (-10)

    Value range: [0, 65535], Default: 65535

  • darkLowerLimit (float) –

    Pixels with dark image < darkLowerLimit will be set to invalid (-10)

    Value range: [0, 65535], Default: 10

  • ciMap (itom.dataObject) – 2D-Output object [int16, 2pi-phase-index (>=0) or -10 for invalid]

  • safetyFactor (float, optional) –

    Intensity values that lie in a band around the mean value (bright+dark)/2 will be ignored. The width of the band is given by safetyFactor*(bright-dark)

    Value range: [0, 1], Default: 0

itom.algorithms.calcPhaseMap4(images, contThreas, overExp, phasePhase, modulationMap)

Reconstructs wrapped phase from four 90degree phase shifted images. The phase value is determined using the Carré algorithm: atan2(I3-I1,I2-I0).

Parameters
  • images (itom.dataObject) – 4 x Y x X image stack (uint8 or uint16) with 4 phase shifted images (90° each)

  • contThreas (float) –

    Contrast threshold (val < threas = invalid)

    Value range: [0, 65535], Default: 10

  • overExp (int) –

    Value for over-exposed pixels or 0 if it should not be considered

    Value range: [0, 65535], Default: 255

  • phasePhase (itom.dataObject) – Wrapped phase result (float32, [-pi..pi] or -10 for invalid)

  • modulationMap (itom.dataObject) – Map with intensity modulation (float32, [0..max. overExp], invalids are not marked here)

itom.algorithms.calcPhaseMapN(images, contThreas, overExp, phasePhase, modulationMap)

Reconstructs wrapped phase from N phaseshifted images with a shift of 2pi / N. The definition of the phase is equal to calcPhaseMap4.

Parameters
  • images (itom.dataObject) – N x Y x X continous image stack

  • contThreas (float) –

    Contrast threashold (val < threas = invalid)

    Value range: [0, 65535], Default: 10

  • overExp (int) –

    Value for over-exposed pixels or 0 if it should not be considered

    Value range: [0, 65535], Default: 255

  • phasePhase (itom.dataObject) – Wrapped phase result

  • modulationMap (itom.dataObject) – Map with intensity modulation

itom.algorithms.createXYMaps(dispMap, xMap, yMap, scale, dLateral, shiftInXNotY)

Creates the X- and Y-Map for the given disparity map. The values consider the given scaling factor and the disparity-dependent shift due to the tilted illumination.

Parameters
  • dispMap (itom.dataObject) – 2D disparity map (float32)

  • xMap (itom.dataObject) – 2D x-map (float32)

  • yMap (itom.dataObject) – 2D y-map (float32)

  • scale (float) –

    Base-Scaling value (mm/px)

    Value range: [0, 65535], Default: 10

  • dLateral (float) –

    Lateral-shift per disparity value (mm/mm)

    Value range: [-65535, 65535], Default: 0

  • shiftInXNotY (int) –

    0: lateral shift in y-direction, 1: in x-direction

    Value range: [0, 1], Default: 0

itom.algorithms.genGraycodePattern(dataObj, axis[, patternSequence, offset, offsetAutoCenter])

generates the graycode pattern that fills up the given data object of type uint8, uint16 or uint32

Parameters
  • dataObj (itom.dataObject) – 2d data object whose data is filled with the pattern along the given axis (0, 1). Type must be uint8, uint16 or uint32

  • axis (int) –

    axis along the pattern is generated (0: along columns, 1: along rows)

    Value range: [0, 1], Default: 0

  • patternSequence (itom.dataObject, optional) – MxN data object of type uint8 with the single patterns (black = 0, white = 255). N corresponds to the necessary bit width, M is equal to the number of rows or columns of dataObj depending on axis

  • offset (int, optional) –

    it is possible to apply an offset to each row- or column number before calculating the graycode. This can be done in order to ‘center’ the graycode sequence. If offsetAutoCenter is 1, the offset is set to [(1<<necessaryBitWidth) - (rows or cols)]/2

    Value range: [0, inf], Default: 0

  • offsetAutoCenter (int, optional) –

    see offset

    Value range: [0, 1], Default: 0

Returns

usedOffset - applied offset to each pixel number, that is the gray-code is determined from [(row or col) + offset]

Return type

int

Returns

bitWidth - bit width for the requested pattern

Return type

int

itom.algorithms.gray2DecLookup(graycodeBitWidth, gcToDecLUT[, offset])

creates a 1xN lookup table to convert a gray-code value into its corresponding decimal value.

The gray-code has a maximal width of graycodeBitWidth. Hence, N corresponds 1 << (graycodeBitWidth+1) To apply this lookup table to a dataObject or numpy array, consider using the numpy method take(lut,array) that returns (lut[array[i]] for i in array).

Parameters
  • graycodeBitWidth (int) –

    number of bits in the gray code (number of used gray-code sequences)

    Value range: [1, 32], Default: 3

  • gcToDecLUT (itom.dataObject) – lookup table, 1xN, uint8, uint16 or uint32 depending on graycodeBitWidth

  • offset (int, optional) –

    possible offset that is subtracted from each decimal value in the lookup table. This is necessary if the graycode sequence has been generated using a positive offset

    Value range: [0, inf], Default: 0

itom.algorithms.unwrapPhaseGray(contThreas, maxPha, ciMap, rawPhase, modulationMap, phaseMap)

Unwrapped phase by Graycode (CiMap)

Parameters
  • contThreas (float) –

    Contrast threashold (val < threas = invalid)

    Value range: [0, 65535], Default: 10

  • maxPha (float) –

    Highest possible unwrapped phase

    Value range: [0, 65535], Default: 65535

  • ciMap (itom.dataObject) – 2D Inputobject from evaluated Graycode (int16)

  • rawPhase (itom.dataObject) – 2D Raw (wrapped) phase (float32) (NaN is represented -10, else [-pi,pi])

  • modulationMap (itom.dataObject) – 2D Modulation map from phase evaluation (float32)

  • phaseMap (itom.dataObject) – Absolute height value (result) [float32] range: [0,maxPha] or NaN for invalid phases