{"id":13737871,"url":"https://github.com/LeviBorodenko/img2rag","last_synced_at":"2025-05-08T15:31:56.463Z","repository":{"id":57437837,"uuid":"255997645","full_name":"LeviBorodenko/img2rag","owner":"LeviBorodenko","description":"Convert any image into a Region Adjacency Graph (RAG)","archived":false,"fork":false,"pushed_at":"2020-04-27T15:37:45.000Z","size":254,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T23:49:58.697Z","etag":null,"topics":["graph-algorithms","image-processing","image-segmentation","rag","region-adjacency-graph"],"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/LeviBorodenko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-15T18:02:32.000Z","updated_at":"2024-02-25T14:30:16.000Z","dependencies_parsed_at":"2022-09-16T03:24:28.639Z","dependency_job_id":null,"html_url":"https://github.com/LeviBorodenko/img2rag","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/LeviBorodenko%2Fimg2rag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeviBorodenko%2Fimg2rag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeviBorodenko%2Fimg2rag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeviBorodenko%2Fimg2rag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeviBorodenko","download_url":"https://codeload.github.com/LeviBorodenko/img2rag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253096201,"owners_count":21853557,"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":["graph-algorithms","image-processing","image-segmentation","rag","region-adjacency-graph"],"created_at":"2024-08-03T03:02:03.940Z","updated_at":"2025-05-08T15:31:56.218Z","avatar_url":"https://github.com/LeviBorodenko.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## img2rag\n\nConvert any image into its [Region Adjacency Graph](https://ieeexplore.ieee.org/document/841950) which can be used for either image segmentation or to create a graph embedding of the image.\n![scheme](scheme.jpeg)\n\u003chr\u003e\n\n### Installation\n\nSimply run `pip install img2rag`\n\n### What is does\n\nGiven an image, we segement it into perceptually significant regions using first [Felzenszwalb segmentation](http://people.cs.uchicago.edu/~pff/papers/seg-ijcv.pdf) followed by a [threshold-cut](https://ieeexplore.ieee.org/document/841950). We then use the segmented regions to construct the following graph:\n\n1. Each node corresponds to a segmented region.\n2. We connect two regions if they are adjacent.\n\nThis is the so-called region adjacency graph. Furthermore, we add the following node-attributes to each region:\n\n1. Location of the region centeriod\n2. Orientation of the region\n3. Mean and total color of the region\n4. Size in px\n\nThe edges contain the mean-color difference between the two regions\n\n# How to use\n\nSimply import the `RAGimage` class and initiate with any image. Then use the build in methods to access various properties.\n\n\n```python\nfrom img2rag import RAGimage\n\n# We assume the image is given as a numpy array or tf.Tensor with either 2 or 3 dimensions\n# where the third dimension is the optional channel dimension.\nimg_tensor = [...]\n\n# initiate RAGimage instance\nimage_rag = RAGimage(img_tensor)\n\n# RAG as a networkx attributed DiGraph\nimage_rag.rag\n\n# Scikit style labels of the image segementation\nimage_rag.labels\n\n# Adjacency matric of the RAG\nimage_rag.adjacency\n\n# Graph feature matrix of the RAG\n# (Nodes x Node-Features)\nimage_rag.signal\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeviBorodenko%2Fimg2rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLeviBorodenko%2Fimg2rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeviBorodenko%2Fimg2rag/lists"}