aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/argaze/AreaOfInterest/AOIFeatures.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py
index 8b93935..0d9fce0 100644
--- a/src/argaze/AreaOfInterest/AOIFeatures.py
+++ b/src/argaze/AreaOfInterest/AOIFeatures.py
@@ -16,6 +16,14 @@ class AreaOfInterest(numpy.ndarray):
"""Number of coordinates coding area points positions."""
return self.shape[1]
+ def bounding_box(self):
+ """Get area's bounding box."""
+
+ min_x, min_y = numpy.min(self, axis=0)
+ max_x, max_y = numpy.max(self, axis=0)
+
+ return numpy.array([(min_x, min_y), (max_x, min_y), (max_x, max_y), (min_x, max_y)])
+
def center(self):
"""Center of mass"""
return self.mean(axis=0)