diff --git a/samples/python/kalman.py b/samples/python/kalman.py index 8e3748b4de..cc11642648 100755 --- a/samples/python/kalman.py +++ b/samples/python/kalman.py @@ -19,7 +19,7 @@ if PY3: long = int import cv2 -from math import cos, sin +from math import cos, sin, sqrt import numpy as np if __name__ == "__main__": @@ -81,12 +81,12 @@ if __name__ == "__main__": kalman.correct(measurement) - process_noise = kalman.processNoiseCov * np.random.randn(2, 1) + process_noise = sqrt(kalman.processNoiseCov[0,0]) * np.random.randn(2, 1) state = np.dot(kalman.transitionMatrix, state) + process_noise cv2.imshow("Kalman", img) - code = cv2.waitKey(100) % 0x100 + code = cv2.waitKey(100) if code != -1: break