{"id":20219786,"url":"https://github.com/laurencee9/grgimage","last_synced_at":"2025-04-10T16:02:35.655Z","repository":{"id":84156125,"uuid":"127203913","full_name":"laurencee9/GRGImage","owner":"laurencee9","description":"C++ implementation of a networks converter from JPG images.","archived":false,"fork":false,"pushed_at":"2018-04-03T01:38:45.000Z","size":679,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T13:44:29.045Z","etag":null,"topics":["geometric-algorithms","image-converter","network"],"latest_commit_sha":null,"homepage":"http://edwardlaurence.me/portfolio/1993/01/11/facenetwork.html","language":"C++","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/laurencee9.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-28T22:05:19.000Z","updated_at":"2024-03-16T14:41:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"b3db9d38-c9db-4dbd-83a5-3403fc7153c7","html_url":"https://github.com/laurencee9/GRGImage","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laurencee9%2FGRGImage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laurencee9%2FGRGImage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laurencee9%2FGRGImage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laurencee9%2FGRGImage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laurencee9","download_url":"https://codeload.github.com/laurencee9/GRGImage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248249012,"owners_count":21072272,"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":["geometric-algorithms","image-converter","network"],"created_at":"2024-11-14T06:43:48.938Z","updated_at":"2025-04-10T16:02:35.650Z","avatar_url":"https://github.com/laurencee9.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Fast image to network generator\n\nC++ implementation of a network converter from JPG images.\n\n![](./examples/images/zebra_small.jpg) \n\n![](./examples/networks/zebra_small.png)\n\n[Other examples](http://edwardlaurence.me/portfolio/1993/01/11/facenetwork.html)\n\n## Usage\n\n### Compilation\n\nThe two required packages are `boost::program_options` and `CImg`.\n\n```\ncd build\ncmake ../src\nmake\n```\n\n`CImg` can be tricky to import with `cmake` depending on your machine. The current `CMakeLists.txt` has been tested on MacOSX 10.13.1. However, on Ubuntu, you may need to install the following packages:\n\n```\napt-get install cmake libx11-dev libjpeg-dev cimg-dev gnuplot\n```\n\n\n### Creating networks\n\nAfter compiling, the executable `GRGImage` should have been created in the `build` folder. The parameters are passed using `boost::program_options` so you can do\n\n```\n./GRGImage --help\n```\n\nto obtain a complete list of the parameters.\n\n**List of parameters**\n\n| Flag        | Type  | Description  |\n| ---------- |:-------------:| :-----|\n| --imagePath (-i)     | String | Path to the JPG image |\n| --outputPath (-o)    | String | Path to dump the output data (add prefix of data output) |\n| --number_nodes (-N) | Int | Number of nodes in the resulting network|\n| --degree (-d) | Int | Maximum degree of a node (usually 3 or 4)|\n| --constrast | Float | Contrast parameter between -infinity to infinity. If positive, darker pixels will have a larger weight than lighter pixels. If you have a dark background, I suggest to use negative constrats.  |\n| --neigh (-n) | Int | maximum number of neighbor pixels that a node can connect to (for faster convergence) |\n| --help || Show the parameters list|\n|--transform | | Required to transform the network |\n|--displayGray | | Not implemented |\n|--CSV | | Output the data in CSV format |\n|--GNU | | Output the data in a Gnuplot compatible format |\n\n\n### Example \n\nExamples have been made available in the `examples` folder. \n\nFor the glasses example, we run: \n\n```\n../build/GRGImage -i ./images/glasses.jpg -o ./data/glasses -N 1000 -d 3 --contrast 3.7 --transform --CSV --GNU\n```\n\n1000 nodes are enough to get a sharp image. \n\n\n### Plotting\n\nA Gnuplot script does the plotting for us. In the past, I used matplotlib but it was very slow (2-3 minutes for plotting). I also used a `d3.js` script to show the images in the browser that I could release if requested.\n\nThe Gnuplot script takes some parameters\n\n| Params        | Type  | Description  |\n| ---------- |:-------------:| :-----|\n| dat   | String | Path to the dat file|\n| o | String | Output path of the image (do not include the extension) |\n|w | Int | Width of the original image (written on the dat file) |\n|h| Int | Height of the original image (written on the dat file) |\n|r | Float | The ratio between the output size and the original size |\n|png| Int | If png=1, the image will be png|\n|pdf| Int | If pdf=1, the image will be pdf|\n|lw | Float | Linewidth of the edges |\n\nAn example is\n\n```\ngnuplot -e \"dat='./data/glasses_width1200_height748.dat'; o='./networks/glasses';w=1200;h=748;r=1;png=1;lw=1.8\" ../src/GNU_plot.gpi\n```\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurencee9%2Fgrgimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaurencee9%2Fgrgimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurencee9%2Fgrgimage/lists"}