Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saharshleo/easyroi
Custom ROI in Computer Vision Applications
https://github.com/saharshleo/easyroi
computer-vision custom-region-of-interest line-roi multiple-region-of-interest multiple-roi opencv polygon region-of-interest
Last synced: 3 months ago
JSON representation
Custom ROI in Computer Vision Applications
- Host: GitHub
- URL: https://github.com/saharshleo/easyroi
- Owner: saharshleo
- License: mit
- Created: 2021-02-12T17:25:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-19T12:52:31.000Z (over 2 years ago)
- Last Synced: 2024-10-11T16:22:49.764Z (3 months ago)
- Topics: computer-vision, custom-region-of-interest, line-roi, multiple-region-of-interest, multiple-roi, opencv, polygon, region-of-interest
- Language: Python
- Homepage: https://pypi.org/project/EasyROI/
- Size: 43.6 MB
- Stars: 51
- Watchers: 5
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![stargazers](https://img.shields.io/github/stars/saharshleo/easyROI)
![issues](https://img.shields.io/github/issues/saharshleo/easyROI)
![forks](https://img.shields.io/github/forks/saharshleo/easyROI)
![license](https://img.shields.io/github/license/saharshleo/easyROI)# [EasyROI](https://github.com/saharshleo/easyROI)
[![Downloads](https://pepy.tech/badge/easyroi/month)](https://pepy.tech/project/easyroi)
[![PyPI version](https://badge.fury.io/py/EasyROI.svg)](https://badge.fury.io/py/EasyROI)
Helper library for drawing ROI in Computer Vision Applications
**Now you can crop the drawn roi's**![demo](https://github.com/saharshleo/easyROI/blob/main/assets/run.gif)
## Table of Contents
- [EasyROI](#easyroi)
- [Table of Contents](#table-of-contents)
- [About The Project](#about-the-project)
- [Tech Stack](#tech-stack)
- [File Structure](#file-structure)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Using EasyROI in your project](#using-easyroi-in-your-project)
- [Rectangular roi](#rectangular-roi)
- [Line Roi](#line-roi)
- [Circle Roi](#circle-roi)
- [Polygon Roi](#polygon-roi)
- [Cropping drawn roi](#cropping-drawn-roi)
- [Formats of roi](#formats-of-roi)
- [Rectangle](#rectangle)
- [Line](#line)
- [Circle](#circle)
- [Polygon](#polygon)
- [Future Work](#future-work)
- [Contributors](#contributors)
- [Acknowledgements and Resources](#acknowledgements-and-resources)
- [License](#license)## About The Project
### Tech Stack
* [Python](https://www.python.org/)
* [OpenCV](https://opencv.org/)
* [Numpy](https://numpy.org/)### File Structure
.
├── EasyROI
│ ├── __init__.py
│ ├── easyROI.py
│ └── utils.py
├── input
│ ├── overpass.mp4
├── output/
├── dev_main.py # Code for testing during developing phase
├── test_library.py # Code for testing during testing phase
├── DEV_README.md # README for developing phase
├── LICENSE
└── README.md
## Getting Started
### Prerequisites
* python>=3.6
* pip### Installation
1. Create virtual environment```sh
python3 -m venv venv_easy_roi
source venv_easy_roi/bin/activate
```2. Install EasyROI
```sh
pip install EasyROI
```If you already have opencv installed:
```sh
pip install --no-dependencies EasyROI
```## Usage
* Read the instruction in terminal while drawing roi
### Using EasyROI in your project
* Initializing
```python
from EasyROI import EasyROIroi_helper = EasyROI(verbose=True)
```#### Rectangular roi
![rectangle_demo](https://github.com/saharshleo/easyROI/blob/main/assets/rectangle.gif)
```python
rect_roi = roi_helper.draw_rectangle(frame, 3) # quantity=3 specifies number of rectangles to drawframe_temp = roi_helper.visualize_roi(frame, rect_roi)
```* See roi format in - [Rectangle](#rectangle)
#### Line Roi
![line_demo](https://github.com/saharshleo/easyROI/blob/main/assets/line.gif)
```python
line_roi = roi_helper.draw_line(frame, 3) # quantity=3 specifies number of lines to drawframe_temp = roi_helper.visualize_roi(frame, line_roi)
```* See roi format in - [Line](#line)
#### Circle Roi
![circle_demo](https://github.com/saharshleo/easyROI/blob/main/assets/circle.gif)
```python
circle_roi = roi_helper.draw_circle(frame, 3) # quantity=3 specifies number of circles to drawframe_temp = roi_helper.visualize_roi(frame, circle_roi)
```* See roi format in - [Circle](#circle)
#### Polygon Roi
![polygon_demo](https://github.com/saharshleo/easyROI/blob/main/assets/polygon.gif)
```python
polygon_roi = roi_helper.draw_polygon(frame, 3) # quantity=3 specifies number of polygons to drawframe_temp = roi_helper.visualize_roi(frame, polygon_roi)
```* See roi format in - [Polygon](#polygon)
#### Cropping drawn roi
```python
polygon_roi = roi_helper.draw_polygon(frame, 3) # quantity=3 specifies number of polygons to drawcropped_polys = roi_helper.crop_roi(frame, polygon_roi)
```* Can do similarly for rectangular, circle roi
* Returns dictionary with `key` value same as roi_label and value as image of cropped version## Formats of roi
### Rectangle
quantity = 1
```
{
'roi': {
0: {'br_x': 573,
'br_y': 443,
'h' : 105,
'tl_x': 322,
'tl_y': 338,
'w' : 251
}
},'type': 'rectangle'
}
```### Line
quantity = 2
```
{
'roi': {
0: {
'point1': (374, 395),
'point2': (554, 438)
},1: {
'point1': (555, 438),
'point2': (830, 361)
}
},'type': 'line'
}
```### Circle
quantity = 2
```
{
'roi': {
0: {
'center': (330, 355),
'point2': (552, 375),
'radius': 222
},1: {
'center': (702, 374),
'point2': (700, 475),
'radius': 101
}
},'type': 'circle'
}
```### Polygon
quantity = 2
```
{
'roi': {
0: {
'vertices': [
(586, 435),
(534, 582),
(200, 504),
(356, 403)
]
},
1: {
'vertices': [
(1108, 507),
(738, 662),
(709, 497),
(711, 494),
(927, 414)
]
}
},'type': 'polygon'
}
```## Future Work
* See [TODO.md](TODO.md) for seeing developments of this project## Contributors
* [saharshleo](https://github.com/saharshleo)## Acknowledgements and Resources
* [Packaging](https://www.codementor.io/@ajayagrawal295/how-to-publish-your-own-python-package-12tbhi20tf)## [License](LICENSE)