Skip to main content

Phase shifting algorithms for encoding and decoding sinusoidal fringe patterns.

Project description

Fringes

PyPI GitHub top language Read the Docs Code style: black PyPI - License PyPI - Downloads

Easy to use tool for generating and analyzing fringe patterns with phase shifting algorithms.

Coding Scheme
Figure 1: Phase Shift Coding Scheme.

Installation

You can install fringes directly from PyPi via pip:

pip install fringes

Usage

You instantiate, parameterize and deploy the Fringes class:

import fringes as frng  # import module

f = frng.Fringes()      # instantiate class

f.glossary              # get glossary
f.X = 1920              # set width of the fringe patterns
f.Y = 1080              # set height of the fringe patterns
f.K = 2                 # set number of sets
f.N = 4                 # set number of shifts
f.v = [9, 10]           # set spatial frequencies
f.T                     # get number of frames
                            
I = f.encode()          # encode fringe patterns
A, B, x = f.decode(I)   # decode fringe patterns

All parameters are accesible by the respective attributes of the Fringes instance (a glossary of them is obtained by the attribute glossary). They are implemented as class properties (managed attributes). Note that some attributes have subdependencies, hence dependent attributes might change as well. Circular dependencies are resolved automatically.

For generating the fringe pattern sequence I, use the method encode().
It returns a NumPy array in videoshape (frames T, width X, height Y, color channels C).

For analyzing (recorded) fringe patterns, use the method decode().
It returns the Numpy arrays brightness A, modulation B and coordinate x.

Graphical User Interface

Do you need a GUI? Fringes has a sister project that is called Fringes-GUI: https://pypi.org/project/fringes-gui/

Troubleshooting

  • Decoding takes a long time
    This is most likely due to the just-in-time compiler Numba, which is used for this computationally expensive functions: During the first execution, an initial compilation is executed. This can take several tens of seconds up to single digit minutes, depending on your CPU. However, for any subsequent execution, the compiled code is cached and the code of the function runs much faster, approaching the speeds of code written in C.

License

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License

Project Status

This package is under active development, so features and functionally will be added in the future. Feature requests are warmly welcomed!

References

[1] Burke et al., “Reverse engineering by fringe projection,” Interferometry XI: Applications, 2002.

[2] Burke et al., "Deflectometry for specular surfaces: an overview", Advanced Optical Technologies, 2023.

[3] Burke, "Phase Decoding and Reconstruction", Optical Methods for Solid Mechanics: A Full-Field Approach, 2012.

[4] Surrel, "Additive noise effect in digital phase detection", Applied Optics, 1997.

[5] Herráez et al., "Fast two-dimensional phase-unwrapping algorithm based on sorting by reliability following a noncontinuous path", Applied Optics, 2002.

[6] Lei et al., "A novel algorithm based on histogram processing of reliability for two-dimensional phase unwrapping", Optik - International Journal for Light and Electron Optics, 2015.

[7] Takeda et al., "Fourier-transform method of fringe-pattern analysis for computer-based topography and interferometry", Journal of the Optical Society of America, 1982.

[8] Massig and Heppner, "Fringe-pattern analysis with high accuracy by use of the Fourier-transform method: theory and experimental tests", Applied Optocs, 2001.

[9] Fischer et al., "Vorhersage des Phasenrauschens in optischen Messsystemen mit strukturierter Beleuchtung", Technisches Messen, 2012.

[10] EMVA, "Standard for Characterization of Image Sensors and Cameras Release 4.0 Linear", European Machine Vision Association, 2021.

[11] Bothe, "Grundlegende Untersuchungen zur Formerfassung mit einem neuartigen Prinzip der Streifenprojektion und Realisierung in einer kompakten 3D-Kamera", Dissertation, ISBN 978-3-933762-24-5, BIAS Bremen, 2008.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fringes-0.2.0.tar.gz (63.3 kB view hashes)

Uploaded Source

Built Distribution

fringes-0.2.0-py3-none-any.whl (72.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page