{"id":39217626,"url":"https://github.com/teboli/polyblur","last_synced_at":"2026-01-17T23:24:42.745Z","repository":{"id":59301064,"uuid":"471442229","full_name":"teboli/polyblur","owner":"teboli","description":"An unofficial Python (Numpy and Pytorch) implementation of \"Polyblur:  Removing  mild blur by polynomial reblurring\" by Mauricio Delbracio and collaborators.","archived":false,"fork":false,"pushed_at":"2023-02-21T11:03:34.000Z","size":1848,"stargazers_count":48,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-29T02:26:24.305Z","etag":null,"topics":["deblurring","numpy","python","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teboli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-18T16:34:58.000Z","updated_at":"2025-08-25T03:14:27.000Z","dependencies_parsed_at":"2022-09-18T01:11:39.288Z","dependency_job_id":null,"html_url":"https://github.com/teboli/polyblur","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/teboli/polyblur","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teboli%2Fpolyblur","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teboli%2Fpolyblur/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teboli%2Fpolyblur/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teboli%2Fpolyblur/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teboli","download_url":"https://codeload.github.com/teboli/polyblur/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teboli%2Fpolyblur/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28521998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T22:11:28.393Z","status":"ssl_error","status_checked_at":"2026-01-17T22:11:27.841Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deblurring","numpy","python","pytorch"],"created_at":"2026-01-17T23:24:42.677Z","updated_at":"2026-01-17T23:24:42.740Z","avatar_url":"https://github.com/teboli.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Non-official Python Implementation of Polyblur\n\n| \u003cimg src=\"./pictures/peacock_defocus.png\" width=\"360px\"/\u003e | \u003cimg src=\"results/peacock_restored_alpha_6_beta_1.png\" width=\"360px\"/\u003e |\n|:------------------------------------------------:|:----------------------------------------------------------------------:|\n|        \u003ci\u003eSlightly out-of-focus image\u003c/i\u003e        |                 \u003ci\u003eDeblurred result with Polyblur\u003c/i\u003e                  |\n\nThis repository contains a Python implementation of *Polyblur: Removing mild blur by polynomial reblurring* in\nIEEE Transaction on Computational Imaging 2021 by Mauricio Delbracio, Ignacio Garcia-Dorado, Soungjoon Choi, \nDamien Kelly and Peyman Milanfar. We provide Pytorch and Numpy non-official implementations reproducing the quantitative\nand qualitative results of the original paper.\n\nA description an analysis of the algorithm can be found in a companion IPOL paper:\n*Breaking down Polyblur: Fast blind Correction of Small Anisotropic Blurs* in Image Processing OnLine 2022 by Thomas Eboli, \nJean-Michel Morel and Gabriele Facciolo.\u003ca href=\"http://www.ipol.im/pub/art/2022/405/\"\u003e[paper]\u003c/a\u003e\n\u003ca href=\"https://ipolcore.ipol.im/demo/clientApp/demo.html?id=405\"\u003e[demo]\u003c/a\u003e.\n\n\n### Installation\n----------\n\nFirst install the requirements with\n```bash\npip install -r requirements.txt\n```\n\nSecond, install the main module with\n```bash\npython setup.py install\n```\n\nThe Pytorch implementation of this code runs **ONLY** with torch 1.10+ \nversions (because of torch.fft for the computation of the gradients with the pytorch implementation).\n\nAlternatively, you can install the package from pypi.org:\n```bash\npip install polyblur\n```\n\n### Test\n----------\n\nAfter installation from sources or via *pip*, you can test the blind deblurring technique with\n```bash\npython main.py --impath ./pictures/peacock_defocus.png --N 3 --alpha 6 --beta 1\n```\n\nYou can modify several parameters, e.g. the number of Polyblur iterations and\nthe deconvolution filter's parameters $alpha$ and $beta$. You may further overlead the default\ncalibration parameters $c$ and $b$ if you need even more aggressive deblurring.\n\n\n### Import into your projects\n----------\n\nAfter installation, the package is imported to any project with\n```python\nimport polyblur\n```\n\nIt contains a main function *polyblur_deblurring* that is agnostic to the input argument img being a (H,W,C) or (H,W) Numpy array or (B,C,H,W) Pytorch tensor. An example reads:\n```python\nfrom polyblur import polyblur_deblurring\n\nim_restored = polyblur_deblurring(img, n_iter=3, alpha=2, beta=4, c=0.352, b=0.768)\n```\nIt runs three iterations of Polyblur with default parameters and returns and Numpy array or a Pytorch tensor depending on the input.\n\n\nA Pytorch module *PolyblurDeblurring* that inherits from torch.nn.Module is also provided.\nThe module and the functional version above are fully differentiable. They thus can be be put within neurals networks are training losses.\nAn example reads:\n```python \nfrom polyblur import PolyblurDeblurring\n\ndeblurrer = PolyblurDeblurring()\ndeblurrer.to(device)\n\nim_restored = deblurrer(img, n_iter=3, alpha=2, beta=4, c=0.352, b=0.768)\n```\nIt runs three iterations of Polyblur with default parameters and returns a Pytorch tensor.\n\nYou'll most likely have to play with $n_{iter}$, $\\alpha$ and $\\beta$ to get the best deblurring results on one example, or finding a\ndefault set of parameter that works for most images. You can\nalso tweack $c$ and $b$ that are the affine model parameters. The default values are the one calibrated with the code below that\nare similar to that reported in the original paper. You may change them too, but it is not recommanded. Please\nrefer to our \u003ca href=\"http://www.ipol.im/pub/art/2022/405/\"\u003e[paper]\u003c/a\u003e for details on the parameter tuning.\n\n\n\n### Calibration\n----------\n\nWe also provide a code for reproducing the calibration curves of the original paper with our FFT-based implementation of \nthe gradients, or any other one one can image. To compute the slope and intercept \nof the model, please run\n```bash\npython calibration_blur_parameters.py\n```\n\nBelow is an example of the predicted curves for 1% additive Gaussian noise. If you use the exact same implementation \nof the gradients as in this repo, you should find something  like (0.362, -0.468) for the affine model parameters.\nYou should first provide the path\nto the DVI2K validation set.\n\n| \u003cimg src=\"./results/calibration_normal_0.01.jpg\" width=\"360px\"/\u003e | \u003cimg src=\"results/calibration_orthogonal_0.01.jpg\" width=\"360px\"/\u003e |\n|:----------------------------------------------------------------:|:------------------------------------------------------------------:|\n|                 \u003ci\u003ePrincipal blur direction\u003c/i\u003e                  |                  \u003ci\u003eOrthogonal blur direction\u003c/i\u003e                  |\n\n\n### Roadmap\n----------\n\nThis code reproduces the results of the TCI'22 article but is not as fast. Even though it is not the\ngoal of this repository, here are some elements I will enhance in a near future:\n* polybur.domain_transform should be implemented with a C++ or CUDA-based normalized convolution to be faster.\n* the convolution are too slow with FFT. I should implement it with separable filters as in the TCI paper.\n\n\n### Contact \n----------\n\nIf you encounter any problem with the code, please contact me at \u003cthomas.eboli@ens-paris-saclay.fr\u003e.\n\n\n### Citation\n----------\n\nIf this code or the demo are useful for your research, please cite our paper.\n\n```BibTex\n@article{eboli22polyblur,\n  title={Breaking down Polyblur: Fast Blind Correction of Small Anisotropic Blurs},\n  author={Eboli, Thomas and Morel, Jean-Michel and Facciolo, Gabriele},\n  journal={Image Processing On Line},\n  volume={12},\n  pages={435--456},\n  year={2022},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteboli%2Fpolyblur","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteboli%2Fpolyblur","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteboli%2Fpolyblur/lists"}