-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathobject_captured.py
29 lines (21 loc) · 895 Bytes
/
object_captured.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class ObjectName(object):
Person = "person"
Dog = "dog"
class ObjectCaptured(object):
_MIN_PERSON_LENGTH = 3 / 100 # 3% of screen width
_MIN_OBJ_LENGTH = 2 / 100 # 2% of screen width
def __init__(self, name, boundingBox, confScore):
self.name = name
self.boundingBox = boundingBox
self.confScore = confScore
def getEstimatedDistance(self):
# Distance is the inverse of bounding box length
return 1.0 / self.boundingBox.length()
def getEyeCenter(self):
return Vector(self.boundingBox.center()[0], self.boundingBox.y1 + self.boundingBox.height() * 0.1)
def isBigEnough(self):
if self.name == ObjectName.Person and self.boundingBox.length() >= self._MIN_PERSON_LENGTH:
return True
if self.boundingBox.length() >= self._MIN_OBJ_LENGTH:
return True
return False