@@ -23,13 +23,16 @@ type Blobie struct {
23
23
noMatchTimes int
24
24
PredictedNextPosition image.Point
25
25
26
+ classID int
27
+ className string
28
+
26
29
// For array tracker
27
30
drawingOptions * DrawOptions
28
31
crossedLine bool
29
32
}
30
33
31
34
// NewBlobie - Constructor for Blobie (default values)
32
- func NewBlobie (rect image.Rectangle , maxPointsInTrack int ) * Blobie {
35
+ func NewBlobie (rect image.Rectangle , maxPointsInTrack , classID int , className string ) * Blobie {
33
36
center := image .Pt ((rect .Min .X * 2 + rect .Dx ())/ 2 , (rect .Min .Y * 2 + rect .Dy ())/ 2 )
34
37
width := float64 (rect .Dx ())
35
38
height := float64 (rect .Dy ())
@@ -45,6 +48,8 @@ func NewBlobie(rect image.Rectangle, maxPointsInTrack int) *Blobie {
45
48
isStillBeingTracked : true ,
46
49
noMatchTimes : 0 ,
47
50
51
+ classID : classID ,
52
+ className : className ,
48
53
crossedLine : false ,
49
54
}
50
55
}
@@ -70,10 +75,28 @@ func NewBlobieDefaults(rect image.Rectangle) *Blobie {
70
75
isStillBeingTracked : true ,
71
76
noMatchTimes : 0 ,
72
77
78
+ classID : - 1 ,
79
+ className : "No class" ,
73
80
crossedLine : false ,
74
81
}
75
82
}
76
83
84
+ // SetClass - Set class information (eg. classID=1, className=vehicle)
85
+ func (b * Blobie ) SetClass (classID int , className string ) {
86
+ b .SetClassID (classID )
87
+ b .SetClassName (className )
88
+ }
89
+
90
+ // SetClassID - Set class identifier
91
+ func (b * Blobie ) SetClassID (classID int ) {
92
+ b .classID = classID
93
+ }
94
+
95
+ // SetClassName - Set class name
96
+ func (b * Blobie ) SetClassName (className string ) {
97
+ b .className = className
98
+ }
99
+
77
100
// Update - Update info about blob
78
101
func (b * Blobie ) Update (newb Blobie ) {
79
102
b .CurrentRect = newb .CurrentRect
0 commit comments