Skip to content

Commit 952ab8e

Browse files
committed
Update docs: fix API examples for merge, to_dict, iou, warp
1 parent 6202d14 commit 952ab8e

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

docs/howto/coco-format.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ For batch operations without creating objects::
4646
array = rlemasklib.decode(coco_dict)
4747

4848
# Operations on dicts
49-
union_dict = rlemasklib.merge([dict1, dict2], intersect=False)
50-
intersection_dict = rlemasklib.merge([dict1, dict2], intersect=True)
49+
from rlemasklib import BoolFunc
50+
union_dict = rlemasklib.merge([dict1, dict2], BoolFunc.UNION)
51+
intersection_dict = rlemasklib.merge([dict1, dict2], BoolFunc.INTERSECTION)
5152

5253
Uncompressed counts
5354
-------------------
@@ -66,7 +67,7 @@ Extra compression
6667
For even smaller storage, gzip the compressed counts::
6768

6869
# Returns dict with "zcounts" instead of "counts" (~40% smaller)
69-
compressed_dict = mask.to_dict(compressed=True)
70+
compressed_dict = mask.to_dict(zlevel=6)
7071

7172
# Loading auto-detects the format
7273
mask = RLEMask.from_dict(compressed_dict)

docs/howto/compute-iou.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ With COCO-format dicts::
3030

3131
import rlemasklib
3232

33-
iou_matrix = rlemasklib.iou([mask1_dict, mask2_dict], [mask3_dict, mask4_dict])
33+
iou = rlemasklib.iou([mask1_dict, mask2_dict])
3434

3535
Manual computation
3636
------------------

docs/howto/warp-mask.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ For rotation, scaling, shearing, translation::
1616
[0.1, 0.9, 20]
1717
], dtype=np.float32)
1818

19-
warped = mask.warp_affine(M, dst_shape=(480, 640))
19+
warped = mask.warp_affine(M, output_imshape=(480, 640))
2020

2121
Perspective transform
2222
---------------------
@@ -30,7 +30,7 @@ For 3x3 homography matrices::
3030
[0.0001, 0.0002, 1]
3131
], dtype=np.float32)
3232

33-
warped = mask.warp_perspective(H, dst_shape=(480, 640))
33+
warped = mask.warp_perspective(H, output_imshape=(480, 640))
3434

3535
From OpenCV
3636
-----------
@@ -44,11 +44,11 @@ If you have a transform matrix from OpenCV::
4444
dst_pts = np.array([[10, 10], [110, 20], [5, 115]], dtype=np.float32)
4545
M = cv2.getAffineTransform(src_pts, dst_pts)
4646

47-
warped = mask.warp_affine(M, dst_shape)
47+
warped = mask.warp_affine(M, output_imshape)
4848

4949
# Or perspective from 4 points
5050
H = cv2.getPerspectiveTransform(src_4pts, dst_4pts)
51-
warped = mask.warp_perspective(H, dst_shape)
51+
warped = mask.warp_perspective(H, output_imshape)
5252

5353
Resize
5454
------
@@ -61,7 +61,7 @@ Simple scaling is a special case::
6161
# Or use warp_affine with a scale matrix
6262
scale = 0.5
6363
M = np.array([[scale, 0, 0], [0, scale, 0]], dtype=np.float32)
64-
resized = mask.warp_affine(M, dst_shape)
64+
resized = mask.warp_affine(M, output_imshape)
6565

6666
Decode-warp-encode fallback
6767
---------------------------

0 commit comments

Comments
 (0)