@@ -15,6 +15,48 @@ func TestSimpleArrayTracker(t *testing.T) {
1515 rectHalfWidth := 75
1616
1717 correctOverallBlobies := 3
18+ commonOptions := BlobOptions {
19+ ClassID : classID ,
20+ ClassName : className ,
21+ MaxPointsInTrack : maxPointsInTrack ,
22+ }
23+ for i := range objectOne {
24+ centerOne := objectOne [i ]
25+ centerTwo := objectTwo [i ]
26+ centerThree := objectThree [i ]
27+
28+ rectOne := image .Rect (centerOne [0 ]- rectHalfWidth , centerOne [1 ]- rectHalfHeight , centerOne [0 ]+ rectHalfWidth , centerOne [1 ]+ rectHalfHeight )
29+ rectTwo := image .Rect (centerTwo [0 ]- rectHalfWidth , centerTwo [1 ]- rectHalfHeight , centerTwo [0 ]+ rectHalfWidth , centerTwo [1 ]+ rectHalfHeight )
30+ rectThree := image .Rect (centerThree [0 ]- rectHalfWidth , centerThree [1 ]- rectHalfHeight , centerThree [0 ]+ rectHalfWidth , centerThree [1 ]+ rectHalfHeight )
31+
32+ blobOne := NewSimpleBlobie (rectOne , & commonOptions )
33+ blobTwo := NewSimpleBlobie (rectTwo , & commonOptions )
34+ blobThree := NewSimpleBlobie (rectThree , & commonOptions )
35+ currentFrameBlobies := []Blobie {blobOne , blobTwo , blobThree }
36+ allblobies .MatchToExisting (currentFrameBlobies )
37+
38+ if correctOverallBlobies != len (allblobies .Objects ) {
39+ t .Errorf ("[Simple] Total number of blobs on frame %d should be %d, bot got %d" , i , correctOverallBlobies , len (allblobies .Objects ))
40+ }
41+ }
42+ }
43+
44+ func TestKalmanArrayTracker (t * testing.T ) {
45+ maxPointsInTrack := 150
46+ classID := 1
47+ className := "just_an_object"
48+ allblobies := NewBlobiesDefaults ()
49+
50+ rectHalfHeight := 30
51+ rectHalfWidth := 75
52+
53+ correctOverallBlobies := 3
54+ commonOptions := BlobOptions {
55+ ClassID : classID ,
56+ ClassName : className ,
57+ MaxPointsInTrack : maxPointsInTrack ,
58+ TimeDeltaSeconds : 1.0 ,
59+ }
1860 for i := range objectOne {
1961 centerOne := objectOne [i ]
2062 centerTwo := objectTwo [i ]
@@ -24,14 +66,14 @@ func TestSimpleArrayTracker(t *testing.T) {
2466 rectTwo := image .Rect (centerTwo [0 ]- rectHalfWidth , centerTwo [1 ]- rectHalfHeight , centerTwo [0 ]+ rectHalfWidth , centerTwo [1 ]+ rectHalfHeight )
2567 rectThree := image .Rect (centerThree [0 ]- rectHalfWidth , centerThree [1 ]- rectHalfHeight , centerThree [0 ]+ rectHalfWidth , centerThree [1 ]+ rectHalfHeight )
2668
27- blobOne := NewSimpleBlobie (rectOne , maxPointsInTrack , classID , className )
28- blobTwo := NewSimpleBlobie (rectTwo , maxPointsInTrack , classID , className )
29- blobThree := NewSimpleBlobie (rectThree , maxPointsInTrack , classID , className )
69+ blobOne := NewKalmanBlobie (rectOne , & commonOptions )
70+ blobTwo := NewKalmanBlobie (rectTwo , & commonOptions )
71+ blobThree := NewKalmanBlobie (rectThree , & commonOptions )
3072 currentFrameBlobies := []Blobie {blobOne , blobTwo , blobThree }
3173 allblobies .MatchToExisting (currentFrameBlobies )
3274
3375 if correctOverallBlobies != len (allblobies .Objects ) {
34- t .Errorf ("Total number of blobs on frame %d should be %d, bot got %d" , i , correctOverallBlobies , len (allblobies .Objects ))
76+ t .Errorf ("[Kalman] Total number of blobs on frame %d should be %d, bot got %d" , i , correctOverallBlobies , len (allblobies .Objects ))
3577 }
3678 }
3779}
0 commit comments