{"id":22929987,"url":"https://github.com/lanzani/computer-vision-design-patterns","last_synced_at":"2026-01-29T02:11:42.044Z","repository":{"id":227925897,"uuid":"727335822","full_name":"lanzani/computer-vision-design-patterns","owner":"lanzani","description":"Commonly used software engineering design pattern in computer vision applications.","archived":false,"fork":false,"pushed_at":"2025-03-20T15:27:27.000Z","size":169,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T16:36:33.458Z","etag":null,"topics":["computer-vision","design-patterns","python-patterns","software-engineering"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lanzani.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}},"created_at":"2023-12-04T16:55:58.000Z","updated_at":"2025-03-20T15:27:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b1f2e04-b20a-424b-8d4a-628bda4ce930","html_url":"https://github.com/lanzani/computer-vision-design-patterns","commit_stats":null,"previous_names":["lanzani/computer-vision-design-patterns"],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanzani%2Fcomputer-vision-design-patterns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanzani%2Fcomputer-vision-design-patterns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanzani%2Fcomputer-vision-design-patterns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanzani%2Fcomputer-vision-design-patterns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lanzani","download_url":"https://codeload.github.com/lanzani/computer-vision-design-patterns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246672992,"owners_count":20815490,"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":["computer-vision","design-patterns","python-patterns","software-engineering"],"created_at":"2024-12-14T10:19:59.696Z","updated_at":"2026-01-29T02:11:42.038Z","avatar_url":"https://github.com/lanzani.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Computer Vision Design Patterns\n\n[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-border.json)](https://github.com/copier-org/copier)\n[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n[![GitHub Release](/reports/version-badge.svg?dummy=8484754)]()\n[![Coverage Status](/reports/coverage-badge.svg?dummy=8484744)](./reports/coverage/index.html)\n\n## Tecnology stack\n\n- [uv](https://docs.astral.sh/uv/) for python and project manager\n- [pre-commit](https://pre-commit.com/) with [ruff](https://docs.astral.sh/ruff/) to mantain code consistency and pre-commit checks\n- [GitHub Actions](https://github.com/features/actions) to create release and publish package (also on a private registry)\n\n## Installation\n\n**Note**: You need [uv](https://docs.astral.sh/uv/) (and uv only) installed on your machine.\n\nTo install the package:\n\n```bash\nuv sync\n```\n\n# Usage\n\n## Events\n\n### TimeEvent\n\nTimeEvent activates immediately when triggered and automatically deactivates after a specified duration.\n\n```python\nfrom computer_vision_design_patterns.event import TimeEvent\nimport time\n\n# Create an event that stays active for 2 seconds\nevent = TimeEvent(2)\n\n# Trigger the event\nevent.trigger()\nprint(event.is_active())  # True\n\n# After 2 seconds\ntime.sleep(2)\nprint(event.is_active())  # False\n\n# Retriggering resets the timer\nevent.trigger()\nprint(event.is_active())  # True again\n```\n\n### CountdownEvent\n\nCountdownEvent starts inactive, counts down for a specified duration, and then activates.\n\n```python\nfrom computer_vision_design_patterns.event import CountdownEvent\nimport time\n\n# Create a countdown event for 3 seconds\nevent = CountdownEvent(3)\n\n# Start the countdown\nevent.trigger()\nprint(event.is_active())  # False (still counting down)\n\n# After 3 seconds\ntime.sleep(3)\nprint(event.is_active())  # True (countdown completed)\n\n# Reset the event\nevent.reset()\nprint(event.is_active())  # False\n```\n\n### Key Differences\n\n1. **TimeEvent**:\n\n   - Activates immediately upon trigger and can be triggered multiple times\n   - Automatically deactivates after the duration has elapsed\n   - Can be reset by triggering again\n\n2. **CountdownEvent**:\n   - Starts inactive\n   - Can be triggered multiple times\n   - Activates only after countdown completes\n   - Stays active until manually reset\n\n### Examples\n\nCheck the `dev` folder for comprehensive examples of both event types.\n\n## Counters\n\n### ManualCounter\n\nManualCounter is a simple counter that activates when it reaches a specified threshold value. It requires manual updates and can be reset to start counting again.\n\n```python\nfrom computer_vision_design_patterns.counter import ManualCounter\nimport time\n\n# Create a counter that activates after 3 counts\ncounter = ManualCounter(3)\n\n# Update the counter\ncounter.update()\nprint(counter.is_active())  # False (count = 1)\n\ncounter.update()\nprint(counter.is_active())  # False (count = 2)\n\ncounter.update()\nprint(counter.is_active())  # True (count = 3)\n\n# Reset the counter\ncounter.reset()\nprint(counter.is_active())  # False (count = 0)\n```\n\n## Examples\n\nCheck the `dev/` folder for comprehensive examples of counter usage.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanzani%2Fcomputer-vision-design-patterns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flanzani%2Fcomputer-vision-design-patterns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanzani%2Fcomputer-vision-design-patterns/lists"}