Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/memona008/polygon_manager
https://github.com/memona008/polygon_manager
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/memona008/polygon_manager
- Owner: memona008
- License: mit
- Created: 2021-11-26T15:02:31.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-07T17:36:26.000Z (almost 3 years ago)
- Last Synced: 2024-10-29T15:41:11.110Z (2 months ago)
- Language: Python
- Homepage: https://pypi.org/project/polygon-manager/
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Polygon Manager
[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)]()
## Features
- Create a dictionary containing polygon points
- View drawn polygons
- Get polygon points and use it anywhere## Tech
Polygon Manager only uses a number of open source projects to work properly:
- [Numpy]
- [OpenCV]
- [Shapely]And of course Polygon Manager itself is open source with a [https://github.com/memona008/Polygon_Manager][poly]
on GitHub.## Installation
Install the package with entering this command in command line interface
```
pip3 install polygon_manager==0.1.2
```## Usage
#### Create an object of Polygon Manager it will create a pkl file in root folder
```
from polygon_manager import PolygonManager
pm = PolygonManager()
```#### To create/edit a polygon
```
pm.create_new_polygon(camera_no='10', vid_path='/path/to/video/')
```It will open a window with first frame of video where you can add points Clockwise or Anti-Clockwise by clicking on picture. To undo the recent added point; use right click.
![Polygon Points](https://user-images.githubusercontent.com/43179211/143847530-2734a4f2-a94a-4456-818b-cad84e8d904f.PNG)
#### To view all polygons
```
pm.view_polygons()
```#### To view some specific polygon pass the camera name/number
```
pm.view_polygons('10')
```![Drawn_Polygon](https://user-images.githubusercontent.com/43179211/143847634-a0055a49-48fd-491b-bc69-27882ecc726d.PNG)
#### To delete an existing polygon
```
pm.delete_polygon('10')
```It will return True or False based on deletion of polygon. And will throw exception if the polygon doesn't exist
#### To check if a point lies in polygon or not
```
pm.is_point_in_polygon(point=(1,2),polygon_name='10')
```It will return True or False based on point position in polygon. And will throw exception if the polygon doesn't exist
#### To get polygon points to use it anywhere else
```
pm.get_polygon_points('10')
```
For example: [[32, 667], [279, 559], [551, 462], [766, 380], [972, 286], [1191, 204], [1407, 265], [1179, 412], [955, 531], [738, 664], [513, 817], [185, 1007]]#### To Calculate IOU/Intersection of boxes over POLYGON
***Different formats of boxes can be used
Supported formats: XYXY, XYWH***
```
pm.box_to_poly_iou(bbox_list=[[515, 149, 621, 286],[654, 159, 721, 186]], '13', mode=pm.BOX_MODE_XYXY)
pm.box_to_poly_iou(bbox_list=[[568.0000, 217.5000, 106.0000, 137.0000]], '13', mode=pm.BOX_MODE_XYWH)
```
For example: [0.08, 0.44]
[0.78][poly]:
## License
MIT