Skip to content

Commit fb16d70

Browse files
authored
Merge pull request #3 from v7labs/rle
rle support
2 parents 0c5263e + 695c161 commit fb16d70

File tree

5 files changed

+21725
-1
lines changed

5 files changed

+21725
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ Similar to OpenCV's `cv2.findContours` but lacking hierarchies. Also similar to
6161

6262
Note that currently the input mask to find_contour needs to be uint8.
6363

64+
## rle_encode
65+
`rle_encode(mask: array[:,:]) -> list`
66+
Takes a 2-dim binary mask and generates a run length encoding according to the coco specs
67+
68+
~ 15 times faster than written in plain python
69+

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
setuptools.Extension("draw_polygon", ["upolygon/draw_polygon" + ext], extra_compile_args=["-O3", "-Wall"]),
1212
setuptools.Extension("find_contours", ["upolygon/find_contours" + ext], extra_compile_args=["-O3", "-Wall"]),
1313
setuptools.Extension("simplify_polygon", ["upolygon/simplify_polygon" + ext], extra_compile_args=["-O3", "-Wall"]),
14+
setuptools.Extension("rle", ["upolygon/rle" + ext], extra_compile_args=["-O3", "-Wall"]),
1415
]
1516

1617
if USE_CYTHON:
@@ -20,7 +21,7 @@
2021

2122
setuptools.setup(
2223
name="upolygon",
23-
version="0.1.4",
24+
version="0.1.5",
2425
author="V7",
2526
author_email="simon@v7labs.com",
2627
description="Collection of fast polygon operations for DL",

upolygon/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from draw_polygon import draw_polygon # noqa
22
from find_contours import find_contours # noqa
33
from simplify_polygon import simplify_polygon # noqa
4+
from rle import rle_decode, rle_encode # noqa

0 commit comments

Comments
 (0)