Skip to content

Commit ddc843d

Browse files
committed
with center
1 parent 5dbf161 commit ddc843d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

mot/simple_blob.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,32 @@ type SimpleBlob struct {
2929
tracker *kalman_filter.Kalman2D
3030
}
3131

32+
func NewSimpleBlobWithCenterTime(currentCenter Point, currentBbox Rectangle, dt float64) *SimpleBlob {
33+
diagonal := math.Sqrt(math.Pow(currentBbox.Width, 2) + math.Pow(currentBbox.Height, 2))
34+
35+
/* Kalman filter props */
36+
ux := 1.0
37+
uy := 1.0
38+
stdDevA := 2.0
39+
stdDevMx := 0.1
40+
stdDevMy := 0.1
41+
kf := kalman_filter.NewKalman2D(dt, ux, uy, stdDevA, stdDevMx, stdDevMy, kalman_filter.WithState2D(currentCenter.X, currentCenter.Y))
42+
blob := SimpleBlob{
43+
id: uuid.New(),
44+
currentBBox: currentBbox,
45+
currentCenter: currentCenter,
46+
predictedNextPosition: Point{X: 0, Y: 0},
47+
track: make([]Point, 0, 150),
48+
maxTrackLen: 150,
49+
active: false,
50+
noMatchTimes: 0,
51+
diagonal: diagonal,
52+
tracker: kf,
53+
}
54+
blob.track = append(blob.track, blob.currentCenter)
55+
return &blob
56+
}
57+
3258
func NewSimpleBlobWithTime(currentBbox Rectangle, dt float64) *SimpleBlob {
3359
centerX := currentBbox.X + currentBbox.Width/2.0
3460
centerY := currentBbox.Y + currentBbox.Height/2.0

0 commit comments

Comments
 (0)