23
23
24
24
# Prepare image for drawing trajectory
25
25
voTruthPoints , voTrackPoints = [], []
26
+ plt .show ()
26
27
27
28
# Process next frames
28
29
for frameIdx in range (1 , datasetReader .getFramesCount ()- 1 ):
45
46
voTruthPoints .append ([truthT [0 ], truthT [2 ]])
46
47
voTrackPoints .append ([currT [0 ], currT [2 ]])
47
48
49
+ plt .cla ()
50
+ plt .plot (np .array (voTrackPoints )[:,0 ], np .array (voTrackPoints )[:,1 ], c = 'blue' , label = "Estimation" )
51
+ plt .plot (np .array (voTruthPoints )[:,0 ], np .array (voTruthPoints )[:,1 ], c = 'green' , label = "Ground truth" )
52
+ plt .title ("Trajectory" )
53
+ plt .legend ()
54
+ plt .draw ()
55
+ plt .pause (0.01 )
56
+
48
57
drawFrameFeatures (currFrame , prevPts , currPts , frameIdx )
49
58
if cv2 .waitKey (1 ) == ord ('q' ):
50
59
break
51
60
52
61
prevFrame = currFrame
53
62
prevPts = currPts
54
63
64
+ plt .savefig ('trajectory.png' )
65
+ cv2 .waitKey (0 )
55
66
cv2 .destroyAllWindows ()
56
-
57
- plt .title ("Trajectory" )
58
- voTruthPoints = np .array (voTruthPoints )
59
- voTrackPoints = np .array (voTrackPoints )
60
- plt .scatter (voTruthPoints [:,0 ], voTruthPoints [:,1 ], c = 'green' , label = "Ground truth" )
61
- plt .scatter (voTrackPoints [:,0 ], voTrackPoints [:,1 ], c = 'blue' , label = "Estimation" )
62
- plt .legend ()
63
- plt .show ()
0 commit comments