mirror of
https://github.com/qurator-spk/eynollah.git
synced 2025-10-15 19:09:58 +02:00
polygon2contour
: avoid uint for coords
(introduced in a433c736
to make consistent with
`filter_contours_area_of_image`, but actually
np.uint is prone to create overflows downstream)
This commit is contained in:
parent
2056a8bdb9
commit
e8b7212f36
1 changed files with 1 additions and 1 deletions
|
@ -276,7 +276,7 @@ def contour2polygon(contour: Union[np.ndarray, Sequence[Sequence[Sequence[Number
|
||||||
|
|
||||||
def polygon2contour(polygon: Polygon) -> np.ndarray:
|
def polygon2contour(polygon: Polygon) -> np.ndarray:
|
||||||
polygon = np.array(polygon.exterior.coords[:-1], dtype=int)
|
polygon = np.array(polygon.exterior.coords[:-1], dtype=int)
|
||||||
return np.maximum(0, polygon).astype(np.uint)[:, np.newaxis]
|
return np.maximum(0, polygon).astype(int)[:, np.newaxis]
|
||||||
|
|
||||||
def make_intersection(poly1, poly2):
|
def make_intersection(poly1, poly2):
|
||||||
interp = poly1.intersection(poly2)
|
interp = poly1.intersection(poly2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue