Skip to main content

ROI Helper

Project description

stargazers issues forks license

EasyROI

Downloads PyPI version

Helper library for drawing ROI in Computer Vision Applications

demo

Table of Contents

About The Project

Tech Stack

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
python3 -m venv venv_easy_roi
source venv_easy_roi/bin/activate
  1. Install EasyROI
pip install EasyROI

Usage

  • Read the instruction in terminal while drawing roi

Using EasyROI in your project

  • Initializing
from EasyROI import EasyROI

roi_helper = EasyROI(verbose=True)

Rectangular roi

rectangle_demo

rect_roi = roi_helper.draw_rectangle(frame, 3)  # quantity=3 specifies number of rectangles to draw

frame_temp = roi_helper.visualize_roi(frame, rect_roi)

Line Roi

line_demo

line_roi = roi_helper.draw_line(frame, 3)  # quantity=3 specifies number of lines to draw

frame_temp = roi_helper.visualize_roi(frame, line_roi)
  • See roi format in - Line

Circle Roi

circle_demo

circle_roi = roi_helper.draw_circle(frame, 3)   # quantity=3 specifies number of circles to draw

frame_temp = roi_helper.visualize_roi(frame, circle_roi)

Polygon Roi

polygon_demo

polygon_roi = roi_helper.draw_polygon(frame, 3) # quantity=3 specifies number of polygons to draw

frame_temp = roi_helper.visualize_roi(frame, polygon_roi)

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 for seeing developments of this project

Contributors

Acknowledgements and Resources

License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EasyROI-1.0.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

EasyROI-1.0.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file EasyROI-1.0.3.tar.gz.

File metadata

  • Download URL: EasyROI-1.0.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/47.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.6.10

File hashes

Hashes for EasyROI-1.0.3.tar.gz
Algorithm Hash digest
SHA256 63148f93bf40335b0676aa8c969214ecaf0f0ad0452adb519f1732427df2c78b
MD5 8fc33262e37b1e69a2df63969293cbfd
BLAKE2b-256 da7ddf8240a75727b4448d9b9301f74ed41fe8f6345403fe855ea9b38b960b78

See more details on using hashes here.

File details

Details for the file EasyROI-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: EasyROI-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/47.2.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.6.10

File hashes

Hashes for EasyROI-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 06a72c3e8af317797411bf8119541fb61d3064977f9c318e7725098232975d5d
MD5 70e9b8619611c964582977cb5e2c9e82
BLAKE2b-256 d5b61e5c539b6c85f4a1dea074257ddfb90a5faa559a7f3884dd2ec5718b10af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page