In this case, we read video files of a red ball following a parabolic path and try to fit a curve along it's trajectory using least square method. To test the least square error minimization, we are testing the code for noiseless data (video1) and data with noise (video2)
The equation of parabola is
To minimize the error, the unknown variables must have zero derivatives. Hence:
Next step is to solve the above three linear equations and get values for a, b, c. The code and result can be found here
Navigate to /Problem2 directory
python3 /Problem2/PythonCodes/GetData.py
Enter path to the csv file and input video when prompted
This will generate two files a graph plot png images with coordinate plots and a csv file with ball x,y coordinates
ball_video1.mp4
ball_video2.mp4
python3 /Problem2/PythonCodes/LSS.py
This will generate two graph plot png images, with curve fit output of two videos