I am using the KalmanFilter Class in OpenCV to predict a Point.
I am tracking an Contour that means i recieve an x,y Point of it.
So my Code looks like that:
First I say that I got 4 dynamic parameters and 2 measurement parameters. The way i understood it is that my tracked (x,y) Positions are my measurements and with the velocity of them i got 4 dynamic parameters
#Give Input to Kalman class
kalman = cv2.KalmanFilter(4,2)
kalman.measurementMatrix = np.array([[1,0,0,0],[0,1,0,0]],np.float32)
kalman.transitionMatrix = np.array([[1,0,1,0],[0,1,0,1],[0,0,1,0],[0,0,0,1]],np.float32)
After this i track my contour in opencv and pass the position to the class.
mp = np.array([[np.float32(center_x)],[np.float32(center_y)]])
kalman.correct(mp)
tp = kalman.predict()
PredictedPointx,PredictedPointy = int(tp[0]),int(tp[1])
And as a result i get 2 Predicted Points and my code works.
The thing is i dont know what exactly happens in this whole process.
I got some questions like
- Why does my transition matrix look like this
And not like this :
Is it correct that i recieve the velocity after giving my 2 points?
Where are all the other Kalman values and calculations. For example the Kalman Gain and so on.
Can someone explain what exactly happens after passing in my x and y position.
Thank you for reading