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
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 which is called Fringes-GUI: https://pypi.org/project/fringes-gui/

Documentation

The documentation can be found here: https://fringes.readthedocs.io

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 function: 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 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.3.0.tar.gz (49.7 kB view hashes)

Uploaded Source

Built Distribution

fringes-0.3.0-py3-none-any.whl (54.2 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