Skip to main content

Phase shifting algorithms for encoding and decoding sinusoidal fringe patterns.

Project description

Fringes

PyPI PyPI - Python Version Code style: black Read the Docs PyPI - License Static Badge PyPI - Downloads

Easily create customized fringe patterns and analyse them using phase shifting algorithms.

coding-cheme}
Figure 1: Phase Shifting Coding Scheme.

Features

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.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 as class properties (managed attributes) of the Fringes instance.

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

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

Note:
For the compitationally expensive decoding we make use of the just-in-time compiler Numba. 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 and energy settings. 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.

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

License

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License

Citation

If you use this software, please cite it using this DOI: 10.5281/zenodo.10936353
This DOI represents all versions, i.e. the concept of this software package, and will always resolve to the latest one.

If you want to cite a specific version, please choose the respective DOI from Zenodo yourself.

Support

I was looking for a user-friendly tool to configure, encode and decode customized fringe patterns with phase shifting algorithms. Since I couldn't find any, I started developing one myself. It is intended for non-commercial, academic and educational use.

However, I do this entirely in my free time. If you like this package and can make use of it, I would be happy about a donation. It will help me keep it up-to-date and adding more features in the future.

paypal

Thank you!

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-1.1.1.tar.gz (54.7 kB view hashes)

Uploaded Source

Built Distribution

fringes-1.1.1-py3-none-any.whl (56.3 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