Skip to content

Commit

Permalink
Merge pull request #3 from v7labs/rle
Browse files Browse the repository at this point in the history
rle support
  • Loading branch information
simedw authored Jan 13, 2021
2 parents 0c5263e + 695c161 commit fb16d70
Show file tree
Hide file tree
Showing 5 changed files with 21,725 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ Similar to OpenCV's `cv2.findContours` but lacking hierarchies. Also similar to

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

## rle_encode
`rle_encode(mask: array[:,:]) -> list`
Takes a 2-dim binary mask and generates a run length encoding according to the coco specs

~ 15 times faster than written in plain python

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
setuptools.Extension("draw_polygon", ["upolygon/draw_polygon" + ext], extra_compile_args=["-O3", "-Wall"]),
setuptools.Extension("find_contours", ["upolygon/find_contours" + ext], extra_compile_args=["-O3", "-Wall"]),
setuptools.Extension("simplify_polygon", ["upolygon/simplify_polygon" + ext], extra_compile_args=["-O3", "-Wall"]),
setuptools.Extension("rle", ["upolygon/rle" + ext], extra_compile_args=["-O3", "-Wall"]),
]

if USE_CYTHON:
Expand All @@ -20,7 +21,7 @@

setuptools.setup(
name="upolygon",
version="0.1.4",
version="0.1.5",
author="V7",
author_email="simon@v7labs.com",
description="Collection of fast polygon operations for DL",
Expand Down
1 change: 1 addition & 0 deletions upolygon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from draw_polygon import draw_polygon # noqa
from find_contours import find_contours # noqa
from simplify_polygon import simplify_polygon # noqa
from rle import rle_decode, rle_encode # noqa
Loading

0 comments on commit fb16d70

Please sign in to comment.