# Fringes
[![PyPI](https://img.shields.io/pypi/v/fringes)](https://pypi.org/project/fringes/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fringes)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Read the Docs](https://img.shields.io/readthedocs/fringes)](https://fringes.readthedocs.io)
[![PyPI - License](https://img.shields.io/pypi/l/fringes)](https://github.com/comimag/fringes/blob/main/LICENSE.txt)
[![Static Badge](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.10936353-blue)](https://zenodo.org/doi/10.5281/zenodo.10936353)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/fringes)](https://pypistats.org/packages/fringes)
<!---
[![PyPI - Downloads](https://img.shields.io/pypi/dm/fringes)](https://pypistats.org/packages/fringes)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/comimag/fringes/python-package.yml)
![GitHub top language](https://img.shields.io/github/languages/top/comimag/fringes)
![https://img.shields.io/badge/python-%3E=3.9-blue](https://img.shields.io/badge/python-%3E=3.9-blue)
![GitHub](https://img.shields.io/github/license/comimag/fringes)
[![Downloads](https://static.pepy.tech/badge/fringes)](https://pepy.tech/project/fringes)
--->
<!---
link to paper, please cite
--->
Easily create customized fringe patterns
and analyse them using phase shifting algorithms.
![coding-cheme}](https://raw.githubusercontent.com/comimag/fringes/main/docs/source/01_start/coding-scheme.gif)\
Figure 1: Phase Shifting Coding Scheme.
## Features
- [Create](https://fringes.readthedocs.io/en/main/02_tutorial/fundamentals.html#encoding) and
[analyze](https://fringes.readthedocs.io/en/main/02_tutorial/fundamentals.html#decoding)
customized fringe patterns
- [Parameterize](https://fringes.readthedocs.io/en/main/02_tutorial/params.html) the phase shifting algorithm
- Generalized Temporal Phase Unwrapping (GTPU)
- [Multiplexing](https://fringes.readthedocs.io/en/main/02_tutorial/mux.html) fringe patterns
- [Filtering](https://fringes.readthedocs.io/en/main/02_tutorial/filter.html) methods
<!---
todo: add reference to GTPU-paper
- Uncertainty Propagation
- [Optimal Coding Strategy](https://fringes.readthedocs.io/en/main/user_guide/optimal.html)
--->
## Installation
You can install `fringes` directly from [PyPi](https://pypi.org/) via `pip`:
```
pip install fringes
```
## Usage
You instantiate, parameterize and deploy the `Fringes` class:
```python
from fringes import Fringes
f = Fringes() # instantiate class
```
All [parameters](https://fringes.readthedocs.io/en/main/02_tutorial/params.html)
are accessible as class properties (managed attributes) of the `Fringes` instance.
```python
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
T = f.T # get number of frames
```
For generating the fringe pattern sequence `I`, use the method `encode()`.
It returns a [NumPy array](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) in video-shape (frames, height, width, color channels).
```python
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](https://fringes.readthedocs.io/en/main/01_start/usage.html#minimal-working-example)):
```python
# allocate image stack
I_rec = []
for t in range(f.T):
# display frame on screen
frame = I[t]
...
# capture scene with camera
image = ...
# append to image stack
I_rec.append(image)
```
For analyzing (recorded) fringe patterns, use the method `decode()`.
It returns the Numpy arrays brightness `a`, modulation `b` and coordinate `x`.
```python
a, b, x = f.decode(I_rec) # decode fringe patterns
```
> Note:\
For the computationally expensive ``decode()``-function
we make use of the just-in-time compiler [Numba](https://numba.pydata.org/).
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.
A minimal working example - including image recording - can be found in the
[documentation](https://fringes.readthedocs.io/en/main/01_start/usage.html#minimal-working-example).
## 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
https://fringes.readthedocs.io
## License
[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License](
https://github.com/comimag/Fringes/blob/main/LICENSE.txt)
## Citation
If you use this software, please cite it using this DOI:
[10.5281/zenodo.10936353](https://zenodo.org/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](https://zenodo.org/doi/10.5281/zenodo.10936353).
## 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 add more features in the future.
<!---
[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/comimag/donate/)
[![](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EHBGZ229DKUC4)
--->
[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=PayPal&logoColor=white)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EHBGZ229DKUC4)
Thank you!
Raw data
{
"_id": null,
"home_page": "https://github.com/comimag/fringes",
"name": "Fringes",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.9",
"maintainer_email": null,
"keywords": "phase shifting, phase unwrapping, fringe analysis, fringe projection, deflectometry, computational imaging",
"author": "Christian Kludt",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/8b/71/a4d9e899c501b887b1ec9d6d0ba0296b3b21ffdb3e280e51eb1051424a1f/fringes-1.1.3.tar.gz",
"platform": null,
"description": "# Fringes\n[![PyPI](https://img.shields.io/pypi/v/fringes)](https://pypi.org/project/fringes/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fringes)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Read the Docs](https://img.shields.io/readthedocs/fringes)](https://fringes.readthedocs.io)\n[![PyPI - License](https://img.shields.io/pypi/l/fringes)](https://github.com/comimag/fringes/blob/main/LICENSE.txt)\n[![Static Badge](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.10936353-blue)](https://zenodo.org/doi/10.5281/zenodo.10936353)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/fringes)](https://pypistats.org/packages/fringes)\n\n<!---\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/fringes)](https://pypistats.org/packages/fringes)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/comimag/fringes/python-package.yml)\n![GitHub top language](https://img.shields.io/github/languages/top/comimag/fringes)\n![https://img.shields.io/badge/python-%3E=3.9-blue](https://img.shields.io/badge/python-%3E=3.9-blue)\n![GitHub](https://img.shields.io/github/license/comimag/fringes)\n[![Downloads](https://static.pepy.tech/badge/fringes)](https://pepy.tech/project/fringes)\n--->\n\n<!---\nlink to paper, please cite\n--->\n\nEasily create customized fringe patterns\nand analyse them using phase shifting algorithms.\n\n![coding-cheme}](https://raw.githubusercontent.com/comimag/fringes/main/docs/source/01_start/coding-scheme.gif)\\\nFigure 1: Phase Shifting Coding Scheme.\n\n## Features\n- [Create](https://fringes.readthedocs.io/en/main/02_tutorial/fundamentals.html#encoding) and\n [analyze](https://fringes.readthedocs.io/en/main/02_tutorial/fundamentals.html#decoding)\n customized fringe patterns\n- [Parameterize](https://fringes.readthedocs.io/en/main/02_tutorial/params.html) the phase shifting algorithm\n- Generalized Temporal Phase Unwrapping (GTPU)\n- [Multiplexing](https://fringes.readthedocs.io/en/main/02_tutorial/mux.html) fringe patterns\n- [Filtering](https://fringes.readthedocs.io/en/main/02_tutorial/filter.html) methods\n\n<!---\ntodo: add reference to GTPU-paper\n- Uncertainty Propagation\n- [Optimal Coding Strategy](https://fringes.readthedocs.io/en/main/user_guide/optimal.html)\n--->\n\n## Installation\nYou can install `fringes` directly from [PyPi](https://pypi.org/) via `pip`:\n\n```\npip install fringes\n```\n\n## Usage\nYou instantiate, parameterize and deploy the `Fringes` class:\n\n```python\n\nfrom fringes import Fringes\n\nf = Fringes() # instantiate class\n```\n\nAll [parameters](https://fringes.readthedocs.io/en/main/02_tutorial/params.html)\nare accessible as class properties (managed attributes) of the `Fringes` instance.\n\n```python\nf.X = 1920 # set width of the fringe patterns\nf.Y = 1080 # set height of the fringe patterns\nf.K = 2 # set number of sets\nf.N = 4 # set number of shifts\nf.v = [9, 10] # set spatial frequencies\nT = f.T # get number of frames\n```\n\nFor generating the fringe pattern sequence `I`, use the method `encode()`.\nIt returns a [NumPy array](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html) in video-shape (frames, height, width, color channels).\n\n```python\nI = f.encode() # encode fringe patterns\n```\n\nNow display each frame of the fringe pattern sequence on a screen and capture the scene with a camera\naccording to the following pseudocode\n(a minimal working example is depicted\n[here](https://fringes.readthedocs.io/en/main/01_start/usage.html#minimal-working-example)):\n\n```python\n# allocate image stack\nI_rec = []\n\nfor t in range(f.T):\n # display frame on screen\n frame = I[t]\n ...\n\n # capture scene with camera\n image = ...\n \n # append to image stack\n I_rec.append(image)\n```\n\nFor analyzing (recorded) fringe patterns, use the method `decode()`.\nIt returns the Numpy arrays brightness `a`, modulation `b` and coordinate `x`.\n\n```python\na, b, x = f.decode(I_rec) # decode fringe patterns\n```\n\n> Note:\\\nFor the computationally expensive ``decode()``-function\nwe make use of the just-in-time compiler [Numba](https://numba.pydata.org/).\nDuring the first execution, an initial compilation is executed.\nThis can take several tens of seconds up to single digit minutes, depending on your CPU and energy settings.\nHowever, for any subsequent execution, the compiled code is cached and the code of the function runs much faster,\napproaching the speeds of code written in C.\n\nA minimal working example - including image recording - can be found in the\n[documentation](https://fringes.readthedocs.io/en/main/01_start/usage.html#minimal-working-example).\n\n## Graphical User Interface\n<!---\nDo you need a GUI? `Fringes` has a sister project which is called `Fringes-GUI`:\n--->\nhttps://pypi.org/project/fringes-gui/\n\n## Documentation\nhttps://fringes.readthedocs.io\n\n## License\n[Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License](\nhttps://github.com/comimag/Fringes/blob/main/LICENSE.txt)\n\n## Citation\nIf you use this software, please cite it using this DOI:\n[10.5281/zenodo.10936353](https://zenodo.org/doi/10.5281/zenodo.10936353)\\\nThis DOI represents all versions, i.e. the concept of this software package,\nand will always resolve to the latest one.\n\nIf you want to cite a specific version,\nplease choose the respective DOI from [Zenodo](https://zenodo.org/doi/10.5281/zenodo.10936353).\n\n## Support\nI was looking for a user-friendly tool to configure,\nencode and decode customized fringe patterns with phase shifting algorithms.\nSince I couldn't find any, I started developing one myself.\nIt is intended for non-commercial, academic and educational use.\n\nHowever, I do this entirely in my free time.\nIf you like this package and can make use of it, I would be happy about a donation.\nIt will help me keep it up-to-date and add more features in the future.\n\n<!---\n[![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/comimag/donate/)\n[![](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EHBGZ229DKUC4)\n--->\n\n[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=PayPal&logoColor=white)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EHBGZ229DKUC4)\n\nThank you!\n",
"bugtrack_url": null,
"license": "CC-BY-NC-SA-4.0",
"summary": "Phase shifting algorithms for encoding and decoding sinusoidal fringe patterns.",
"version": "1.1.3",
"project_urls": {
"Documentation": "https://fringes.readthedocs.io",
"Homepage": "https://github.com/comimag/fringes",
"Repository": "https://github.com/comimag/fringes"
},
"split_keywords": [
"phase shifting",
" phase unwrapping",
" fringe analysis",
" fringe projection",
" deflectometry",
" computational imaging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2e5d0127b36e40e854f835ddcdd45fef1e147c4bd66399d3510fba139896919b",
"md5": "108f87a46c2e436968882d72c4604ac6",
"sha256": "75775c873b40f3f6c82e62e9674d9e205755537399fbc0291779efa7811abf88"
},
"downloads": -1,
"filename": "fringes-1.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "108f87a46c2e436968882d72c4604ac6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.9",
"size": 70711,
"upload_time": "2024-11-17T11:58:21",
"upload_time_iso_8601": "2024-11-17T11:58:21.834188Z",
"url": "https://files.pythonhosted.org/packages/2e/5d/0127b36e40e854f835ddcdd45fef1e147c4bd66399d3510fba139896919b/fringes-1.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8b71a4d9e899c501b887b1ec9d6d0ba0296b3b21ffdb3e280e51eb1051424a1f",
"md5": "223fcf14b381e9fd822cd411e3dae0f5",
"sha256": "7662810a115b20be6cbf5560bb457a617c270198607c1bd25ba4fd1caa21e0fe"
},
"downloads": -1,
"filename": "fringes-1.1.3.tar.gz",
"has_sig": false,
"md5_digest": "223fcf14b381e9fd822cd411e3dae0f5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.9",
"size": 55229,
"upload_time": "2024-11-17T11:58:23",
"upload_time_iso_8601": "2024-11-17T11:58:23.797408Z",
"url": "https://files.pythonhosted.org/packages/8b/71/a4d9e899c501b887b1ec9d6d0ba0296b3b21ffdb3e280e51eb1051424a1f/fringes-1.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-17 11:58:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "comimag",
"github_project": "fringes",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fringes"
}