{"id":49552425,"url":"https://github.com/leoraclet/playing-cards-identification","last_synced_at":"2026-05-02T23:49:26.371Z","repository":{"id":331729787,"uuid":"1131916371","full_name":"leoraclet/playing-cards-identification","owner":"leoraclet","description":"👁️ Playing card identification sytem using MATLAB / Octave scripting language.","archived":false,"fork":false,"pushed_at":"2026-01-12T03:32:44.000Z","size":976,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-02T23:48:58.076Z","etag":null,"topics":["cards","identification","image-processing","image-recognition","matlab","matlab-script","octave","octave-scripts"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","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/leoraclet.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-11T00:08:20.000Z","updated_at":"2026-01-12T03:32:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leoraclet/playing-cards-identification","commit_stats":null,"previous_names":["leoraclet/playing-cards-identification"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leoraclet/playing-cards-identification","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoraclet%2Fplaying-cards-identification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoraclet%2Fplaying-cards-identification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoraclet%2Fplaying-cards-identification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoraclet%2Fplaying-cards-identification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leoraclet","download_url":"https://codeload.github.com/leoraclet/playing-cards-identification/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leoraclet%2Fplaying-cards-identification/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32553690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T22:28:24.418Z","status":"ssl_error","status_checked_at":"2026-05-02T22:28:14.225Z","response_time":132,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cards","identification","image-processing","image-recognition","matlab","matlab-script","octave","octave-scripts"],"created_at":"2026-05-02T23:49:25.773Z","updated_at":"2026-05-02T23:49:26.365Z","avatar_url":"https://github.com/leoraclet.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Playing Card Identification\n\nThis project implements a **playing card identification system** using **MATLAB/Octave**. It leverages standard image processing techniques and algorithms to extract key information, including:\n\n- Number of cards\n- Card values\n- Card positions (*used to display their value at the end*)\n\n## 📦 Project Structure\n\n```text\n├── assets/             # Illustrations of the process\n├── src/                # Functions and main program\n|   └── samples         # Sample images\n└── flake.nix           # Nix environment\n```\n\n\u003e [!important]\n\u003e Currently, the code is extensively commented **only in French**.\n\u003e\n\u003e English translations will be added in the future.\n\n## ⚙️ How It Works\n\nThe playing card identification process follows these steps:\n\n1. **Image Loading and Grayscale Conversion**\n   The input image is loaded and converted to grayscale.\n\n2. **Thresholding**\n   A threshold is applied to create a binary (black and white) image, distinguishing the cards from the background.\n\n3. **Dilation**\n   Successive dilation operations are applied to fill the cards completely.\n\n4. **Card Segmentation**\n   A 3-pass segmentation process identifies the number of cards and their positions, assigning unique pixel values to each card.\n\n5. **Design Extraction**\n   The inverse of the thresholded image is taken to isolate the card designs. Refining this image with dilation and erosion operations preserves only the interior designs of the cards.\n\n6. **Symbol Segmentation**\n   The designs are segmented to isolate individual symbols.\n\n7. **Symbol-to-Card Association**\n   The barycenter (center of mass) of each symbol is calculated. Using the segmented card image (from step 4), each symbol is associated with its respective card based on the barycenter's location.\n\n8. **Card Value Determination**\n   The number of symbols per card is counted, determining the card values.\n\n9. **Result Visualization**\n   The barycenter of each card (from step 4) is used to overlay text on the image, displaying the card values and producing the final result.\n\n### Steps Summary\n\nBelow are the steps illustrated with images from each stage of the image processing pipeline.\n\n|         Step 1 - Grey image         |     Step 2 - Black and White image      |\n| :---------------------------------: | :-------------------------------------: |\n|  ![Step1](./assets/card-grey.png)   | ![Step2](./assets/card-black-white.png) |\n|     **Step 3 - Dilated cards**      |      **Step 4 - Segmented cards**       |\n| ![Step3](./assets/card-dilated.png) |     ![Step4](./assets/card-seg.png)     |\n|    **Step 5 - Dilated designs**     |     **Step 6 - Segmented designs**      |\n| ![Step5](./assets/part-dilated.png) |    ![Step6](./assets/parts-seg.png)     |\n|             **Result**              |           **Original image**            |\n|   ![Result](./assets/result.png)    |   ![Original](./assets/original.png)    |\n\n## 🚧 Limits\n\nThis image processing approach is designed to work only for cards with values from **1 (Ace) to 10**. High-rank cards (King, Queen, Jack) have more complex designs that do not directly correspond to their numerical value, so they are not supported by this method.\n\n## 🧪 Testing the Project\n\nBegin by cloning the repository and navigating into the project directory:\n\n```bash\ngit clone https://github.com/leoraclet/playing-cards-identification\ncd playing-cards-identification\n```\n\n### 📥 Installation\n\nEnsure [Octave](https://octave.org/download) is installed on your system.\n\n#### Nix Users\n\nIf you use the Nix package manager with `direnv`, enable the environment by running:\n\n```bash\ndirenv allow\n```\n\n### ✅ Running the Pipeline\n\n1. Launch Octave:\n   ```bash\n   octave\n   ```\n\n2. Install the required `image` package and execute the main script:\n   ```bash\n   pkg install image\n   run src/Traitement.m\n   ```\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoraclet%2Fplaying-cards-identification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleoraclet%2Fplaying-cards-identification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleoraclet%2Fplaying-cards-identification/lists"}