- Create a dictionary containing polygon points
- View drawn polygons
- Get polygon points and use it anywhere
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 on GitHub.
Install the package with entering this command in command line interface
pip3 install polygon_manager==0.1.2
from polygon_manager import PolygonManager
pm = PolygonManager()
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.
pm.view_polygons()
pm.view_polygons('10')
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
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
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]]
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]
MIT