https://github.com/aGIToz/PyInpaint Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} aGIToz / PyInpaint Public * Notifications * Fork 0 * Star 12 A lightweight image inpainting tool in python. 12 stars 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 0 tags Code Latest commit @aGIToz aGIToz Update LICENSE ... f8691e1 Apr 20, 2022 Update LICENSE f8691e1 Git stats * 14 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time data 2 examples Apr 20, 2022 notebooks notebook is ready Apr 20, 2022 pyinpaint notebook is ready Apr 20, 2022 .gitignore first commit Apr 19, 2022 LICENSE Update LICENSE Apr 20, 2022 MANIFEST.in first commit Apr 19, 2022 README.md Update README.md Apr 20, 2022 setup.py first commit Apr 19, 2022 View code PyInpaint Installation Usage Results Video demonstration Params description and usage README.md PyInpaint A lightwieght inpainting tool for images written in python. Basically the inpainting is achieved using harmonic extension on a non-local graph created using image to be inpainted. image * f(u) is the signal (rgb values) on the node u. * \Delta_{w,p} is the weighted graph p Laplacian. * A is the area to be inpainted. * dA is the area where signal is given as g(u). For p=2 the solution to the above equation yields non-local means. image * w(u,v) is the weight on the edge from node u to v. * N(u) is the set of neighbors of node u. * d(u) is the degree at node u. Installation pip install pyinpaint Usage * Command line pyinpaint --org_img "path/to/original/image" --mask "path/to/mask" # pyinpaint --org_img --mask --ps --k_boundary --k_search --k_patch The output is an inpainted image at the path of org_img. * Python from pyinpaint import Inpaint inpaint = Inpaint(org_img, mask) inpainted_img = inpaint() #inpaint = Inpaint(org_img, mask, ps) #inpainted_img = inpaint(k_boundary, k_search, k_patch) This returns a numpy array inpainted_img. Results image image Video demonstration This video shows: * How to create an inpainting mask in Gimp. * How to inpaint using command line. Params description and usage The following description of the parameters is useful to gain speed-ups and to inpaint low spatial frequency texture images. * ps: Patch size, it is used for creating the non-local graph. The default value is 7. To gain speed-up try with 3 or 5. Ideally it should be an odd value. For images with low spatial frequency texture, should be kept high like 11, 13 or 15 ... * k_boundary: This is used to determine the nodes at the intersection of A and dA. The default is 4. To gain speed-up try changing to 8 or 16. * k_search: This is used for searching the non-local neighbors of a node. The default is 1000. For large size images it should be increased. To gain speed-up try with 300, 400, 500. * k_patch: The knn value for the non-local graph construction. The default is 5. Try 3 for speed-up. Try larger value to increase the resolution. About A lightweight image inpainting tool in python. Resources Readme Stars 12 stars Watchers 1 watching Forks 0 forks Releases No releases published Packages 0 No packages published Languages * Jupyter Notebook 99.2% * Python 0.8% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.