:param boxB: the target bounding box to compute overlap :type boxB: BoxBase :return: the intersection area of current bounding box and boxB
(self, boxB)
| 98 | return numpy.array([self.x, self.y, self.x1, self.y1], dtype="float32") |
| 99 | |
| 100 | def intersection(self, boxB): |
| 101 | """ |
| 102 | :param boxB: the target bounding box to compute overlap |
| 103 | :type boxB: BoxBase |
| 104 | :return: the intersection area of current bounding box and boxB |
| 105 | """ |
| 106 | s1 = (self.y1 - self.y) * (self.x1 - self.x) |
| 107 | s2 = (boxB.y1 - boxB.y) * (boxB.x1 - boxB.x) |
| 108 | s0 = 0.0 #intersection area |
| 109 | if not(self.x >= boxB.x1 or boxB.x >= self.x1 or self.y >= boxB.y1 or boxB.y >= self.y1): |
| 110 | x = max(self.x, boxB.x); x1 = min(self.x1, boxB.x1) |
| 111 | y = max(self.y, boxB.y); y1 = min(self.y1, boxB.y1) |
| 112 | s0 = abs(x - x1) * abs(y - y1) |
| 113 | return float(s0) |
| 114 | |
| 115 | def iou(self, boxB): |
| 116 | """ |
no outgoing calls
no test coverage detected