{"id":27298469,"url":"https://github.com/mathieuloutre/shape-detector","last_synced_at":"2025-04-12T00:27:13.667Z","repository":{"id":23823852,"uuid":"27200724","full_name":"MathieuLoutre/shape-detector","owner":"MathieuLoutre","description":"Shape/gesture/stroke detection/recognition algorithm based on the $1 (dollar) Recognizer","archived":false,"fork":false,"pushed_at":"2014-12-09T15:53:49.000Z","size":172,"stargazers_count":56,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T12:58:44.989Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MathieuLoutre.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":"2014-11-26T23:28:18.000Z","updated_at":"2024-10-30T13:19:53.000Z","dependencies_parsed_at":"2022-08-22T05:10:23.958Z","dependency_job_id":null,"html_url":"https://github.com/MathieuLoutre/shape-detector","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuLoutre%2Fshape-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuLoutre%2Fshape-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuLoutre%2Fshape-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuLoutre%2Fshape-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MathieuLoutre","download_url":"https://codeload.github.com/MathieuLoutre/shape-detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248499134,"owners_count":21114261,"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":[],"created_at":"2025-04-12T00:27:10.103Z","updated_at":"2025-04-12T00:27:13.652Z","avatar_url":"https://github.com/MathieuLoutre.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shape Detector\n\n\u003e Shape/gesture/stroke detection/recognition algorithm based on the $1 (dollar) Recognizer\n\nShape Detector is a refactored version of the [$1 (dollar) Recognizer](http://depts.washington.edu/aimgroup/proj/dollar) without the protractor and with a few other tweaks. It's available as a module which can be used client side and with Node.js. \n\n## Usage\n\nInstall using bower: `bower install shape-detector`  \nOr using npm: `npm install shape-detector`  \nOr just by downloading the [tarball](https://github.com/MathieuLoutre/shape-detector/archive/master.zip)\n\n```js\n\n\tvar detector = new ShapeDetector(ShapeDetector.defaultShapes)\n\tvar stroke = [{ x: 127, y: 141 }, { x: 124, y: 140 }, { x: 120, y: 139 }, { x: 118, y: 139 }, { x: 116, y: 139 }, { x: 111, y: 140 }, { x: 109, y: 141 }, { x: 104, y: 144 }, { x: 100, y: 147 }, { x: 96, y: 152 }, { x: 93, y: 157 }, { x: 90, y: 163 }, { x: 87, y: 169 }, { x: 85, y: 175 }, { x: 83, y: 181 }, { x: 82, y: 190 }, { x: 82, y: 195 }, { x: 83, y: 200 }, { x: 84, y: 205 }, { x: 88, y: 213 }, { x: 91, y: 216 }, { x: 96, y: 219 }, { x: 103, y: 222 }, { x: 108, y: 224 }, { x: 111, y: 224 }, { x: 120, y: 224 }, { x: 133, y: 223 }, { x: 142, y: 222 }, { x: 152, y: 218 }, { x: 160, y: 214 }, { x: 167, y: 210 }, { x: 173, y: 204 }, { x: 178, y: 198 }, { x: 179, y: 196 }, { x: 182, y: 188 }, { x: 182, y: 177 }, { x: 178, y: 167 }, { x: 170, y: 150 }, { x: 163, y: 138 }, { x: 152, y: 130 }, { x: 143, y: 129 }, { x: 140, y: 131 }, { x: 129, y: 136 }, { x: 126, y: 139 }]\n\tdetector.spot(stroke) // returns circle\n\n\t// You can also specify what you're looking for\n\tdetector.spot(stroke, 'triangle') // returns null as the circle doesn't match the triangle\n\n\t// The detector can also learn new shapes\n\tstroke = [{ x: 307, y: 216 }, { x: 333, y: 186 }, { x: 356, y: 215 }, { x: 375, y: 186 }, { x: 399, y: 216 }, { x: 418, y: 186 }]\n\tdetector.learn('zig-zag', stroke)\n\n\t// Name lookup is done with indexOf so you can make \"groups\" of shapes\n\tdetector.lean('zig-zag 2', stroke)\n\n\tdetector.spot(stroke, 'zig-zag') // will look for both circle and circle 2 and return the closest\n\n\t// ShapeDetector can also take options\n\t// nbSamplePoints is 64 by default and potentially improves accuracy\n\t// threshold by default is 0, a higher number will be less forgiving of wonky shapes\n\tdetector = ShapeDetector(ShapeDetector.defaultShapes, { nbSamplePoints: 128, threshold: 0.8 })\n\n```\n\n## TODO\n\n- Testing\n- Integrate $P\n\n## Changelog\n\n- 0.2.1 - Improve default shapes\n- 0.2.0 - First release","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieuloutre%2Fshape-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathieuloutre%2Fshape-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieuloutre%2Fshape-detector/lists"}