{"id":23288358,"url":"https://github.com/sebrovater/cv_examples","last_synced_at":"2025-04-06T16:30:21.726Z","repository":{"id":212053270,"uuid":"730582978","full_name":"SEBROVATER/cv_examples","owner":"SEBROVATER","description":"Examples of some self made CV algorithms.","archived":false,"fork":false,"pushed_at":"2024-03-23T17:10:20.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T22:27:29.199Z","etag":null,"topics":["cards","computer-vision","cv","python","suits"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SEBROVATER.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}},"created_at":"2023-12-12T08:38:46.000Z","updated_at":"2024-03-23T17:12:43.000Z","dependencies_parsed_at":"2023-12-12T10:25:39.176Z","dependency_job_id":"ddd37272-4c30-40fb-9d42-aa72fdef786b","html_url":"https://github.com/SEBROVATER/cv_examples","commit_stats":null,"previous_names":["sebrovater/cv_examples"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SEBROVATER%2Fcv_examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SEBROVATER%2Fcv_examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SEBROVATER%2Fcv_examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SEBROVATER%2Fcv_examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SEBROVATER","download_url":"https://codeload.github.com/SEBROVATER/cv_examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247512183,"owners_count":20950812,"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":["cards","computer-vision","cv","python","suits"],"created_at":"2024-12-20T03:16:54.312Z","updated_at":"2025-04-06T16:30:21.700Z","avatar_url":"https://github.com/SEBROVATER.png","language":"Python","readme":"# cv_examples\nExamples of some self made CV algorithms.\n\n---\n## Proportion-resistant suit recognition:\n\n![heart.gif](cards%2Fheart.gif) ![diamond.gif](cards%2Fdiamond.gif)\n\n```Python\ndef heart_or_diamond(suit_binary: npt.NDArray[np.uint8]) -\u003e str:\n    belt_y = np.count_nonzero(suit_binary, axis=1).argmax()\n    belt_x = np.count_nonzero(suit_binary, axis=0).argmax()\n\n    nonzeros = np.nonzero(suit_binary)\n    y1, x1 = np.minimum.reduce(nonzeros, axis=1)\n    y2, x2 = np.maximum.reduce(nonzeros, axis=1)\n\n    yc = (y1 + y2) / 2\n    diff_y = abs(yc - belt_y)\n    gap_y = diff_y / (y2 - y1)\n\n    xc = (x1 + x2) / 2\n    diff_x = abs(xc - belt_x)\n    gap_x = diff_x / (x2 - x1)\n\n    top_belt_y = suit_binary[:, belt_x].argmax()\n\n    if gap_y \u003c 0.15 and gap_x \u003c 0.15 and np.count_nonzero(suit_binary[:top_belt_y]) \u003c= 1:\n        return \"d\"\n    return \"h\"\n```\n\n![club.gif](cards%2Fclub.gif) ![spade.gif](cards%2Fspade.gif)\n\n```Python\ndef club_or_spade(suit_binary: npt.NDArray[np.uint8]) -\u003e str:\n    belt_y = np.count_nonzero(suit_binary, axis=1).argmax()\n    top_half = suit_binary[: belt_y + 1]\n\n    nonzeros = np.nonzero(top_half)\n    y1, x1 = np.minimum.reduce(nonzeros, axis=1)\n    y2, x2 = np.maximum.reduce(nonzeros, axis=1)\n\n    gap = int((x2 - x1) / 4)\n    center = top_half[int((y1 + y2) / 2) + 1:, x1 + gap: x2 - gap + 1]\n\n    if center.all():\n        return \"s\"\n    else:\n        return \"c\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebrovater%2Fcv_examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebrovater%2Fcv_examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebrovater%2Fcv_examples/lists"}