Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/6o6o/fft-descreen
An fft-based descreen filter
https://github.com/6o6o/fft-descreen
Last synced: 29 days ago
JSON representation
An fft-based descreen filter
- Host: GitHub
- URL: https://github.com/6o6o/fft-descreen
- Owner: 6o6o
- License: mit
- Created: 2016-11-05T21:04:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-03-06T07:14:34.000Z (almost 5 years ago)
- Last Synced: 2024-08-03T03:01:32.703Z (4 months ago)
- Language: Python
- Size: 1.24 MB
- Stars: 75
- Watchers: 5
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neural-art - fft-descreen - Clean up deconvolution checkerboard artifacts found in style transferred images. (Super Resolution)
README
# Fourier transform descreen filter
An implementation of GIMP [descreen plugin](http://web.archive.org/web/20161118075437/http://registry.gimp.org/node/24411) in python with OpenCV. It utilizes a custom normalization of magnitude spectrum, found in [fft plugin](http://web.archive.org/web/20161118081031/http://registry.gimp.org/node/19596), which assigns more energy to pixels further away from the center, thus allowing to use regular binary threshold to localize high frequency areas and create a mask automatically. It turned out to be very helpful in case of periodic pattern removal, therefor I adapted it for python.
## Usage
```
python descreen.py images/example.png images/result.png
```![example](images/example.png) ![result](images/result.png)
Optional arguments include
* `--thresh INT, -t INT` - Threshold level for normalized magnitude spectrum
* `--radius INT, -r INT` - Radius to expand the area of mask pixels
* `--middle INT, -m INT` - Ratio for middle preservationThe normalized spectrum and its multi-channel mask of the above example respectively
![norm-spec](images/example-spectrum.png) ![spec-mask](images/example-mask.png)
## Motivation
Originally intended to clean up deconvolution [checkerboard artifacts](http://distill.pub/2016/deconv-checkerboard), found in style transferred images, I thought it may have its uses in other areas, like cleaning low-dpi scans and therefor would be better off as a separate script. I excluded the optional despeckle step, found in original plugin for being too destructive. Instead, I find [waifu2x](//github.com/nagadomi/waifu2x) to give a superior result in case of artistically styled images, thus tend to use it with maximum noise reduction as a second step.
Original image
![orig](images/tubingen_orig.png)
fft-descreen + waifu noise removal
![result](images/tubingen_result.png)