{"id":23268882,"url":"https://github.com/harshitwaldia/traffictally","last_synced_at":"2026-05-05T19:34:13.662Z","repository":{"id":246931047,"uuid":"824672854","full_name":"HarshitWaldia/TrafficTally","owner":"HarshitWaldia","description":"\"Detect and count vehicles in videos using OpenCV for accurate analysis in traffic management and monitoring systems.\"","archived":false,"fork":false,"pushed_at":"2024-07-05T17:30:46.000Z","size":6369,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T23:27:34.432Z","etag":null,"topics":["computer-vision","numpy","opencv","python3","vehicle-counting","vehicle-detection"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/HarshitWaldia.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":"2024-07-05T16:49:22.000Z","updated_at":"2025-06-26T09:08:48.000Z","dependencies_parsed_at":"2024-07-05T22:55:25.437Z","dependency_job_id":"d4394300-3925-4071-82b7-533d74ebcc28","html_url":"https://github.com/HarshitWaldia/TrafficTally","commit_stats":null,"previous_names":["harshitwaldia/traffictally"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HarshitWaldia/TrafficTally","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitWaldia%2FTrafficTally","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitWaldia%2FTrafficTally/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitWaldia%2FTrafficTally/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitWaldia%2FTrafficTally/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarshitWaldia","download_url":"https://codeload.github.com/HarshitWaldia/TrafficTally/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarshitWaldia%2FTrafficTally/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32665111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["computer-vision","numpy","opencv","python3","vehicle-counting","vehicle-detection"],"created_at":"2024-12-19T17:33:04.962Z","updated_at":"2026-05-05T19:34:13.644Z","avatar_url":"https://github.com/HarshitWaldia.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚗 TrafficTally : Vehicle Detection and Counting Notebook 🚙\n\nThis project is a Jupyter notebook application designed to detect and count vehicles in a video stream. It uses OpenCV for image processing and a background subtractor algorithm to identify moving vehicles. The application draws bounding boxes around detected vehicles and counts them as they cross a predefined line in the video frame.\n\n## Features\n\n- **🚘 Vehicle Detection**: Identifies and draws bounding boxes around moving vehicles.\n- **📊 Vehicle Counting**: Counts vehicles as they cross a specified line in the video frame.\n- **⏱️ Real-Time Processing**: Processes video frames in real-time for live counting.\n\n## Requirements\n\n- 🐍 Python 3.x\n- 🖼️ OpenCV\n- 🔢 NumPy\n- 📓 Jupyter\n\n\n## Installattion\n### Setting Up the Environment\n\nIt's recommended to use a virtual environment to manage the dependencies for this project. Follow the steps below to set up the environment using `conda`.\n\n1. Install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/products/distribution) if you haven't already.\n\n2. Create a new conda environment:\n\n    ```bash\n    conda create --name vehicle_counter python=3.8\n    ```\n\n3. Activate the environment:\n\n    ```bash\n    conda activate vehicle_counter\n    ```\n\n4. Install the required packages:\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n## Usage\nTo run the vehicle detection and counting notebook, follow these steps:\n\n1. Ensure you have a video file named `video3.mp4` in the same directory as your notebook, or modify the code to use a different video file.\n\n2. Launch Jupyter Notebook:\n```bash\njupyter notebook\n```\n3. Open the [`main.ipynb`](main.ipynb) notebook and run all cells to start the vehicle detection and counting process.\n\n4. Run all the cells in the notebook to start the vehicle detection and counting process.\n\n## Explanation of Key Components\n- **🔍 Background Subtraction**: Uses cv2.bgsegm.createBackgroundSubtractorMOG() to segment moving objects (vehicles) from the background.\u003cbr\u003e\n- **✏️ Contour Detection**: Detects contours in the segmented frames and draws bounding boxes around the detected vehicles.\u003cbr\u003e\n- **🔢 Vehicle Counting**: Defines a counting line and increments the vehicle count whenever a detected vehicle crosses this line.\u003cbr\u003e\n- **📍 Center Function**: Calculates the center of the bounding box for each detected vehicle.\u003cbr\u003e\n\n## Customization\n- **Change Count Line Position**:\nModify the count_line_position variable to change the position of the counting line.\n\n- **Adjust Rectangle Size**:\nModify the min_width_rectangle and min_height_rectangle variables to adjust the minimum size of detected vehicles.\n\n- **Use Different Video Source**:\nChange the path in cv2.VideoCapture(\"video3.mp4\") to use a different video file or a webcam.\n\n## Code Explanation\nThe script performs the following steps:\n\n- Imports necessary libraries and initializes video capture.\n- Sets parameters for vehicle detection and counting.\n- Defines a background subtraction algorithm and contour detection.\n- Implements real-time processing to count vehicles crossing a designated line.\n\n## Contributions\nContributions are welcome! If you have any suggestions or improvements, please create a pull request or open an issue on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshitwaldia%2Ftraffictally","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharshitwaldia%2Ftraffictally","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharshitwaldia%2Ftraffictally/lists"}