{"id":23872997,"url":"https://github.com/maxwelljay256/ball-tracker","last_synced_at":"2026-04-19T15:03:42.342Z","repository":{"id":240019636,"uuid":"801431605","full_name":"MaxwellJay256/ball-tracker","owner":"MaxwellJay256","description":"Track colored balls with RoboMaster EP","archived":false,"fork":false,"pushed_at":"2024-05-16T11:59:07.000Z","size":1862,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T18:51:30.181Z","etag":null,"topics":["opencv","pid","python","robomaster-ep"],"latest_commit_sha":null,"homepage":"","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/MaxwellJay256.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":"2024-05-16T08:09:39.000Z","updated_at":"2024-05-29T14:00:13.000Z","dependencies_parsed_at":"2025-10-10T18:51:31.244Z","dependency_job_id":"35c90aff-033b-49b5-a293-e46506c6674d","html_url":"https://github.com/MaxwellJay256/ball-tracker","commit_stats":null,"previous_names":["maxwelljay256/ball-tracker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MaxwellJay256/ball-tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxwellJay256%2Fball-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxwellJay256%2Fball-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxwellJay256%2Fball-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxwellJay256%2Fball-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaxwellJay256","download_url":"https://codeload.github.com/MaxwellJay256/ball-tracker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaxwellJay256%2Fball-tracker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32010959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":["opencv","pid","python","robomaster-ep"],"created_at":"2025-01-03T16:37:55.433Z","updated_at":"2026-04-19T15:03:42.314Z","avatar_url":"https://github.com/MaxwellJay256.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ball Tracker\n\nHITSZ 2024 金工实习 机器视觉基础实践选修模块\n\n## Task | 任务\n\n使用大疆 RoboMaster EP 机器人，实现对特定颜色小球的跟踪。编程基于 RM 的官方 SDK。\n\n1. 将机器人获取的 BGR 图像转换为 HSV 图像并显示在窗口中。\n2. 基于 HSV 颜色模型进行图像分割，获取目标颜色的 HSV 阈值。\n3. 根据所得的目标颜色 HSV 阈值对视频流图像帧进行二值化。\n4. 利用形态学处理方法对阈值分割后的图像进行腐蚀、膨胀、开运算、闭运算等操作，去除背景中的噪声，并填充目标物体区域内的空洞。\n5. 在上一步的输出中进行轮廓查找，通过轮廓特征筛选（轮廓面积、轮廓周长、轮廓最小外包圆、拟合椭圆特征等），对目标小球位置进行定位，输出目标小球中心点位置信息。\n6. 引入 PID 控制器，以目标小球位置为输入控制机器人底盘运动，实现对目标小球的跟踪。\n\n## Files | 文件\n\n- Example code:\n  - [`get-image.py`](./references/get_image.py): Get and display images from the camera.\n  - [`bgr-segmentation.py`](./references/bgr_segmentation.py): Segment the image from 3 channels.\n  - [`chassis-speed.py`](./references/chassis_speed.py): Demo code for controlling the chassis.\n  - [`gimbal-speed.py`](./references/gimbal_speed.py): Demo code for controlling the gimbal.\n- Customized code:\n  - `main.py`：Main function for the task.\n\n## Environment | Python 运行环境\n\nPython 3.8 with the packages below:\n1. `robomaster`\n2. `opencv-python`\n3. `numpy`\n\n```bash\npip install robomaster opencv-python numpy\n```\n\n## TODO | 未竟之事\n\n- [ ] Encapsulate the colors to be recognized into a class.\n- [ ] Encapsulate contours into a class.\n- [ ] Encapsulate the PID controller into a class.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxwelljay256%2Fball-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxwelljay256%2Fball-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxwelljay256%2Fball-tracker/lists"}