{"id":21332497,"url":"https://github.com/mdeff/giin","last_synced_at":"2025-06-10T15:03:44.423Z","repository":{"id":95298286,"uuid":"45046120","full_name":"mdeff/giin","owner":"mdeff","description":"Graph-based Image Inpainting","archived":false,"fork":false,"pushed_at":"2020-04-18T16:05:56.000Z","size":1245,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T18:09:15.870Z","etag":null,"topics":["graphs","image-inpainting","image-processing"],"latest_commit_sha":null,"homepage":"https://infoscience.epfl.ch/record/218020","language":"MATLAB","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/mdeff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-27T14:22:21.000Z","updated_at":"2024-08-04T10:59:26.000Z","dependencies_parsed_at":"2023-04-14T01:01:02.662Z","dependency_job_id":null,"html_url":"https://github.com/mdeff/giin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeff%2Fgiin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeff%2Fgiin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeff%2Fgiin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeff%2Fgiin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdeff","download_url":"https://codeload.github.com/mdeff/giin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeff%2Fgiin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259097726,"owners_count":22804773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["graphs","image-inpainting","image-processing"],"created_at":"2024-11-21T22:51:38.179Z","updated_at":"2025-06-10T15:03:44.410Z","avatar_url":"https://github.com/mdeff.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GIIN: Graph-based Image Inpainting\n\n[Michaël Defferrard](https://deff.ch).\nSupervized by [Nathanaël Perraudin](https://perraudin.info),\n[Johan Paratte](https://www.linkedin.com/in/johan-paratte-a2070039).\n\n\u003e The project goal was to explore the applications of spectral graph theory to\n\u003e address the inpainting problem of large missing chunks. We used a non-local\n\u003e patch graph representation of the image and proposed a structure detector which\n\u003e leverages the graph representation and influences the fill-order of our\n\u003e exemplar-based algorithm. Our method achieved state-of-the-art performances.\n\nFull report available at \u003chttps://infoscience.epfl.ch/record/218020\u003e.\n\n![inpainting](inpainting.png)\n\n## The algorithm\n\n1. Identify the potentially fillable unknown pixels.\n2. Give a priority to each of them and identify the one with the highest\n   priority. We will inpaint that pixel.\n3. Find in the image and copy the patch which is the most similar to the patch\n   around the chosen pixel.\n\nOur innovation resides in the way to assign a priority to the unknown pixels. We\nwant to assign a higher priority to the structure than to the texture in order\nto preserve it while reconstructing. We do it the following way:\n\n1. Construct a graph of pixels where the edge weights are defined as a\n   similarity measure between the connected pixels. \n2. Place a dirac on the considered pixel.\n3. Diffuse the dirac with a heat kernel.\n   As seen on the image, the diffused signal is constrained by the cluster\n   around the tested pixel. From there, we should be able to determine if the\n   considered pixel is part of a texture or a structure element. Looking at the\n   spreading of the diffusion, texture and structure pixels are easily tell\n   apart.\n   ![structure](structure.png)\n   ![diffusion](diffusion.png)\n4. The priority is then given by the l2 norm of the diffused signal. See the\n   report for the motivation and mathematical definition.\n5. We finally add a confidence priority so that pixels who are farther away from\n   the known pixels get lower priorities.\n   ![priorities](priorities.png)\n\n## Installation\n\n### Requirements\n\n* [GSPbox](https://lts2.epfl.ch/gsp/): graph signal processing toolbox\n  (version 0.4.0 should work)\n* [UNLocBoX](https://lts2.epfl.ch/unlocbox/): convex optimization toolbox\n\n### Optional speed-up\n\nThe FLANN library implements fast algorithms to approximate nearest neighbors\nsearch. It can be used to speed up the graph construction. It is optional and\nif you do not want to use it you can comment `param.nnparam.use_flann = 1;` in\n`lib/giin_patch_graph.m`.  Otherwise compile it this way:\n\n```sh\ncd gspbox/3rdparty/sources/flann-1.8.4-src/\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake\n```\n\nMake sure that the MATLAB bin folder is in your path to compile the MEX. If it\ndid work you should have a file called `nearest_neighbors.mexa64` in\n`build/src/matlab`.\n\n## Usage\n\n1. Place a file `image.png` in the `data` sub-folder. The masked area should be\n   bright green, i.e. RGB [0,255,0]. You may want to generate some synthetic\n   images with e.g. `giin_image('vertical');`.\n\n2. Launch the inpainting process from MATLAB:\n\n   ```m\n   inpaint('vertical');\n   ```\n\n   Or from the shell:\n\n   ```sh\n   ./launch.sh inpaint vertical\n   ```\n\n   You may then want to adjust the paths to the toolboxes in `launch.sh`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdeff%2Fgiin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdeff%2Fgiin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdeff%2Fgiin/lists"}