Phase shifting algorithms for encoding and decoding sinusoidal fringe patterns.
Project description
Fringes
Easily configure, encode and decode sinusoidal fringe patterns using phase shifting algorithms.
Features
- Configure the phase shifting algorithm
- Encode and decode fringe patterns
- Spatial Phase Unwrapping
- Generalized Temporal Phase Unwrapping
- Multiplexing fringe patterns
- Filtering methods
Installation
You can install fringes directly from PyPi via pip:
pip install fringes
Usage
You instantiate, parameterize and deploy the Fringes class:
from fringes import Fringes # import the Fringes class
f = Fringes() # instantiate Fringes object
All parameters
are accessible as class properties (managed attributes) of the Fringes instance.
f.X = 1920 # set width of the fringe patterns
f.Y = 1080 # set height of the fringe patterns
f.N = 4 # set number of shifts
f.v = [9, 10] # set spatial frequencies
T = f.T # get number of frames
To encode the fringe pattern sequence I, use the method encode().
It returns a NumPy array in video-shape (frames, height, width, color channels).
I = f.encode() # encode fringe patterns
Now display each frame of the fringe pattern sequence on a screen and capture the scene with a camera according to the following pseudocode (a minimal working example is depicted here):
# allocate image stack
Irec = []
for t in range(f.T):
# display frame on screen
frame = I[t]
...
# capture scene with camera
image = ...
# append to image stack
Irec.append(image)
To decode (recorded) fringe patterns, use the method decode().
It returns the Numpy arrays
brightness a,
modulation b and
(screen) coordinate x.
a, b, x = f.decode(Irec) # decode fringe patterns
Note:
For the computationally expensivedecode()-function 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.
More complete code examples can be found in the examples directory.
Support
I was looking for a user-friendly tool for phase shifting. 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 add more features in the future.
Thank you!
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.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fringes-2.0.0.tar.gz.
File metadata
- Download URL: fringes-2.0.0.tar.gz
- Upload date:
- Size: 66.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97da905606c3079b78fb3b5453b0bc7787082be1770f6b3372756c0dae59a932
|
|
| MD5 |
f0c203d15f111a9a94e4bf784a6c2698
|
|
| BLAKE2b-256 |
b0939fde193a61bae04a88de9e54f280684fc3a7047e36ade7589304035fce26
|
File details
Details for the file fringes-2.0.0-py3-none-any.whl.
File metadata
- Download URL: fringes-2.0.0-py3-none-any.whl
- Upload date:
- Size: 62.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4c585fdf84a731b3c588ee9450be943b170743085e5feb174a96a1fb08f6c0e
|
|
| MD5 |
5514ac0d0c87d677a8348223762cdc33
|
|
| BLAKE2b-256 |
3dbe2167ebf161de6942fc6c8f92153d220d9c10a47a9fa687306e8064a527aa
|