{"id":31723265,"url":"https://github.com/trflorian/sudoku-extraction","last_synced_at":"2026-07-09T15:31:09.703Z","repository":{"id":318685394,"uuid":"1065508387","full_name":"trflorian/sudoku-extraction","owner":"trflorian","description":"Extract Sudoku grids from images","archived":false,"fork":false,"pushed_at":"2025-10-16T10:24:07.000Z","size":724,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-28T15:22:58.372Z","etag":null,"topics":["computer-vision","opencv-python","python","sudoku"],"latest_commit_sha":null,"homepage":"https://towardsdatascience.com/classical-computer-vision-and-perspective-transformation-for-sudoku-extraction/","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/trflorian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-27T21:36:24.000Z","updated_at":"2025-10-17T14:03:51.000Z","dependencies_parsed_at":"2025-10-08T17:41:02.203Z","dependency_job_id":"d0674dfe-7692-43c2-8380-7fadc8b93b5f","html_url":"https://github.com/trflorian/sudoku-extraction","commit_stats":null,"previous_names":["trflorian/sudoku-extraction"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/trflorian/sudoku-extraction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trflorian%2Fsudoku-extraction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trflorian%2Fsudoku-extraction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trflorian%2Fsudoku-extraction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trflorian%2Fsudoku-extraction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trflorian","download_url":"https://codeload.github.com/trflorian/sudoku-extraction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trflorian%2Fsudoku-extraction/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35304874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-09T02:00:07.329Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["computer-vision","opencv-python","python","sudoku"],"created_at":"2025-10-09T04:47:40.655Z","updated_at":"2026-07-09T15:31:09.697Z","avatar_url":"https://github.com/trflorian.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sudoku Grid Extraction\n\n![Python](https://img.shields.io/badge/python-3.13-blue.svg)\n![GitHub License](https://img.shields.io/github/license/trflorian/ball-tracking-live-plot?style=flat)\n\nThis project focuses on extracting and processing Sudoku grids from images using classical computer vision techniques.\nIt includes functionalities for detecting the grid, warping the image, and preparing it for further analysis or digit recognition.\n\n![Sudoku Extraction](https://github.com/user-attachments/assets/5f763479-8b19-4e54-bf05-fb9ab1c76a44)\n\n## Quickstart\n\nThis project supports `uv` for easy environment management and script execution.\nTo run the extraction, you can use the provided script.\nSome sample sudoku images are available in the `images/` directory.\n\n```bash\nuv run scripts/extraction.py --image images/sudoku_001.jpg\n```\n\n\u003cimg width=\"640\" alt=\"image\" src=\"https://github.com/user-attachments/assets/1d401a42-a33a-47d4-9054-02344e530f07\" /\u003e\n\n\u003cimg width=\"480\" alt=\"image\" src=\"https://github.com/user-attachments/assets/86cf2168-055d-4791-9af3-6bb7dd2c4441\" /\u003e\n\n\n### Corner Sorting\n\nThe project includes a utility for sorting the corners of the detected Sudoku grid in a consistent order (top-left, top-right, bottom-right, bottom-left).\n\n```bash\nuv run scripts/visualize_corner_sorting.py --type simple\n```\n\n```bash\nuv run scripts/visualize_corner_sorting.py --help\nusage: visualize_corner_sorting.py [-h] [--type {cyclic,assignment,centroid,simple}] [--fps FPS] [--rot_speed ROT_SPEED]\n```\n\n![rotating_rect_skew_working_angles](https://github.com/user-attachments/assets/f6f8ebfb-5423-4046-a985-66b47b0f737e)\n\n## Processing Pipeline\n\nThe main processing steps include:\n1. **Grayscale Conversion**: Convert the input image to grayscale.\n2. **Canny Edge Detection**: Apply Canny edge detection to highlight the edges in the image.\n3. **Contour Detection**: Find contours in the edge-detected image.\n4. **Grid Detection**: Identify the largest quadrilateral contour, which is assumed to be the Sudoku grid.\n5. **Corner Sorting**: Sort the corners of the detected grid using a specified method (e.g., cyclic sort with centroid anchor).\n6. **Perspective Transformation**: Warp the image to obtain a top-down view of the Sudoku grid.\n\n## References\n\n- [OpenCV Documentation](https://docs.opencv.org/)\n- [SciPy Linear Sum Assignment](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linear_sum_assignment.html)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrflorian%2Fsudoku-extraction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrflorian%2Fsudoku-extraction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrflorian%2Fsudoku-extraction/lists"}