Phase shifting algorithms for encoding and decoding sinusoidal fringe patterns.
Project description
Fringes
Easy to use tool for generating and analyzing fringe patterns with phase shifting algorithms.
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/
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 : 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!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.