Metadata-Version: 2.1
Name: kuwahara-torch
Version: 0.0.3
Summary: Kuwahara filter in PyTorch.
Author-email: Evan Arlian <evanarlian2000@gmail.com>
License: MIT License
        
        Copyright (c) 2023 evanarlian
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/evanarlian/kuwahara-torch
Keywords: pytorch,shaders,image,kuwahara
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch
Requires-Dist: numpy
Requires-Dist: Pillow

# kuwahara-torch
Kuwahara filter in PyTorch.

# Usage
See full code and images on [example](example/) dir.
```bash
pip install -U kuwahara-torch
```

# Examples
Originally kuwahara filter was used for denoising.

| Original                | kuwahara                | Generalized kuwahara                |
|------------------------|------------------------|------------------------|
| ![](example/noisy.jpg) | ![](example/noisy_k.jpg) | ![](example/noisy_gk.jpg) |

But now it is used for artistic style.
| Original                | kuwahara                | Generalized kuwahara                |
|------------------------|------------------------|------------------------|
| ![](example/cat.jpg) | ![](example/cat_k.jpg) | ![](example/cat_gk.jpg) |

| Original                | Generalized kuwahara                |
|------------------------|------------------------|
| ![](example/chinatown.jpg) | ![](example/chinatown_gk.jpg) |

# TODO
* [x] Kuwahara
* [x] Generalized kuwahara
* [ ] Anisotropic kuwahara. Idk how to tilt the kernel in pytorch. PRs are welcome.

# References
* https://en.wikipedia.org/wiki/Kuwahara_filter
* [Generalized Kuwahara paper](https://core.ac.uk/download/pdf/148194268.pdf)
* [Anisotropic Kuwahara paper](https://www.kyprianidis.com/p/pg2009/jkyprian-pg2009.pdf)
* [Anisotropic Kuwahara but with polynomials](https://diglib.eg.org/bitstream/handle/10.2312/LocalChapterEvents.TPCG.TPCG10.025-030/025-030.pdf)
* https://docs.blender.org/manual/en/dev/compositing/types/filter/kuwahara.html
* https://www.youtube.com/watch?v=LDhN-JK3U9g
