GithubHelp home page GithubHelp logo

nhauber99 / degradr Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 0.0 8.91 MB

Python library for realistically degrading images.

Home Page: https://www.photometric.io/blog/realistic-image-degradation/

License: Other

Python 98.27% C++ 1.53% Shell 0.20%
blur computer-vision data-augmentation image-degradation machine-learning noise python data-preprocessing image-processing image-quality

degradr's Introduction

degradr

Python library for realistically degrading images.

A blog post explaining the theory behind it a bit more can be found here.

The Demo.py file provides an example usage of the library and should degrade the included test image if you set up everything correctly.

For building the Intel Integrated Performance Primitives Python wrapper, which is needed for demosaicing, please download the IPP libraries (or the whole oneAPI Base Toolkit). Then adapt the additional library and include directories of the Visual Studio project to point to the targeted python version and compile as a Release x64 library. Copy the PyIPP.pyd file somewhere into your pythonpath / adapt the pythonpath (more info in this issue thread: #2). When running into trouble, this guide might help which is what I used for creating the wrapper library. If building on Linux, you're unfortunately on your own, but it should absolutely be doable as well.

The set of matrices for conversions between the camera and sRGB color space was derived from the LibRaw library and does NOT fall under the license of this project.

A sample usage of the library can be found in the Test.py script, which applies all steps necessary for degrading a "perfect" image. Before that, you'll need to run the ZernikePSF.py and PrepKernels.py script to prepare the convolution kernels. The applied steps are as follows (assuming the image is already in the camera color space):

  1. Convert the input image to the assumed camera color space if needed.
  2. Convolve by random blur kernel. (a combination of defocus blur, gaussian blur, PSFs generated from Zernike polynomials to model the lens aberrations, chromatic aberration)
  3. Color filter array (in practice applied directly before the demosaicing for simplicity, but this doesn't affect the output)
  4. Poison noise
  5. Gain
  6. Read Noise
  7. Quantization
  8. Camera white balance
  9. Demosaicing (3 different methods using the Intel Integrated Performance Primitives)
  10. Color space transformation (from white balance corrected camera color space to sRGB)
  11. JPEG Compression


Examples:

Input Image
Blur Image
Blur
Noise
Image
Blur
Noise
CFA
Image
Blur
Noise
CFA
AHD Demosaicing
Image
Blur
Noise
CFA
AHD Demosaicing
JPEG Compression
Image

degradr's People

Contributors

nhauber99 avatar

Stargazers

max avatar  avatar  avatar  avatar Zach Bessinger avatar Crustaceous D avatar  avatar Adnan Pen avatar Dhruv Parikh avatar  avatar Peter Leonard avatar

Watchers

Kostas Georgiou avatar Crustaceous D avatar  avatar  avatar

degradr's Issues

Any plans to integrate with albumentations

Thanks for the work.

Most pipelines use albumentations as it supports a single API for all augmentations. It is battle tested in production and installation is straightforward. This work would reach out to more users if it was integrated with it. Any plans of that?

Also do you have comparisons to albumentations augmentations of some of your functions? Especially implementation details and speed benchmarks.

How to use

Hi,

I have a collection of ~58k HR images for use in training SISR.
I would like to use your code to synthesize their LR pairs.
I'm finding it rather confusing and I'm not really sure how to go about this.
I would greatly appreciate some dumbed-down instructions, if possible.

Kind regards,
terrainer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.