{"id":16751028,"url":"https://github.com/elerac/structuredlight","last_synced_at":"2025-08-09T08:06:30.851Z","repository":{"id":40722776,"uuid":"182905741","full_name":"elerac/structuredlight","owner":"elerac","description":"Generate and Decode structured light. Binary, Gray, XOR, Ramp, Phase-Shifting, Stripe.","archived":false,"fork":false,"pushed_at":"2021-05-30T06:05:33.000Z","size":463,"stargazers_count":146,"open_issues_count":3,"forks_count":28,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-16T07:22:46.509Z","etag":null,"topics":["python","structured-light"],"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/elerac.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":"2019-04-23T02:12:31.000Z","updated_at":"2025-03-10T07:24:54.000Z","dependencies_parsed_at":"2022-07-18T08:13:45.171Z","dependency_job_id":null,"html_url":"https://github.com/elerac/structuredlight","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/elerac%2Fstructuredlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elerac%2Fstructuredlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elerac%2Fstructuredlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elerac%2Fstructuredlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elerac","download_url":"https://codeload.github.com/elerac/structuredlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243961652,"owners_count":20375282,"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":["python","structured-light"],"created_at":"2024-10-13T02:42:52.203Z","updated_at":"2025-03-17T02:30:57.996Z","avatar_url":"https://github.com/elerac.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Structured Light\nThese programs generate and decode structured light. \n\nCurrently supports \n* [Binary code](#Binary-code)\n* [Gray code](#Gray-code)\n* [XOR code](#XOR-code)\n* [Ramp code](#Ramp-code)\n* [Phase Shifting](#Phase-Shifting)\n* [Single stripe](#Single-stripe)\n\n## Installation\n```sh\npip install git+https://github.com/elerac/structuredlight\n```\n\n## Usage\n```python\nimport structuredlight as sl\n\nwidth  = 640\nheight = 480\n\ngray = sl.Gray()\n\nimlist_pattern = gray.generate((width, height))\n\n# Projecting patterns from a projector (or display) and capture images\nimlist_captured = imlist_pattern\n\nimg_index = gray.decode(imlist_captured, thresh=127)\n\nprint(img_index)\n# [[  0   1   2 ... 637 638 639]\n#  [  0   1   2 ... 637 638 639]\n#  ...\n#  [  0   1   2 ... 637 638 639]]\n```\n\n## Supported structured light\n\n### Binary code\n![](documents/binary.gif)\n```python\nbinary = sl.Binary()\nimlist = binary.generate((width, height))\nimg_index = binary.decode(imlist, thresh=127)\n```\n\n### Gray code\n![](documents/gray.gif)\n```python\ngray = sl.Gray()\nimlist = gray.generate((width, height))\nimg_index = gray.decode(imlist, thresh=127)\n```\n\n### XOR code\n![](documents/xor.gif)\n```python\nxor = sl.XOR(index_last=-1)\nimlist = xor.generate((width, height))\nimg_index = xor.decode(imlist, thresh=127)\n```\n\n### Ramp code\n![](documents/ramp.gif)\n```python\nramp = sl.Ramp()\nimlist = ramp.generate((width, height))\nimg_index = ramp.decode(imlist)\n```\n\n### Phase-Shifting\n![](documents/phaseshifting.gif)\n```python\nphaseshifting = sl.PhaseShifting(num=3)\nimlist = phaseshifting.generate((width, height))\nimg_index = phaseshifting.decode(imlist)\n```\n\n### Single stripe\n![](documents/stripe.gif)\n```python\nstripe = sl.Stripe()\nimlist = stripe.generate((width, height))\nimg_index = stripe.decode(imlist)\n```\n\n## Tips\n### How to binarize a grayscale image\nSome of the code (Binary, Gray, XOR, ...) needs to binarize. This program provides three methods. [See the wiki for details.](https://github.com/elerac/structuredlight/wiki#how-to-binarize-a-grayscale-image)\n\n### How to display images in full screen\nWhen you use structured light, you'll need a full screen display from a projector or display. [Here is a program to display the image in full screen.](https://github.com/elerac/fullscreen)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felerac%2Fstructuredlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felerac%2Fstructuredlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felerac%2Fstructuredlight/lists"}