MCPcopy
hub / github.com/zetane/viewer / area_of

Function area_of

models/RFB_320/box_utils.py:3–13  ·  view source on GitHub ↗

Compute the areas of rectangles given two corners. Args: left_top (N, 2): left top corner. right_bottom (N, 2): right bottom corner. Returns: area (N): return the area.

(left_top, right_bottom)

Source from the content-addressed store, hash-verified

1import numpy as np
2
3def area_of(left_top, right_bottom):
4 """
5 Compute the areas of rectangles given two corners.
6 Args:
7 left_top (N, 2): left top corner.
8 right_bottom (N, 2): right bottom corner.
9 Returns:
10 area (N): return the area.
11 """
12 hw = np.clip(right_bottom - left_top, 0.0, None)
13 return hw[..., 0] * hw[..., 1]
14
15def iou_of(boxes0, boxes1, eps=1e-5):
16 """

Callers 1

iou_ofFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected