- Curve-Fitting
- code
- data_files
- plots
- questionnaire.pdf
- report.pdf
A ball is thrown against a white background and a camera sensor is used to track its trajectory. We have a near perfect sensor tracking the ball in video1 and the second sensor is faulty and tracks the ball as shown in video2. Clearly, there is no noise added to the first video whereas there is significant noise in the second video. Assuming that the trajectory of the ball follows the equation of a parabola:
- Use Standard Least Squares to fit curves to the given videos in each case. You have to plot the data and your best fit curve for each case. Submit your code along with the instructions to run it.
1. To generate .csv file from video
python3 generate_csv_file.py --FilePath='./data_files/video1.mp4' --CSVFilePath='./<Path>/<File_Name>.csv'
- FilePath - Video file path. Default :- ' ./data_files/video1.mp4 '
- CSVFilePath - File path to save csv file. Default :- ' ./data_files/data1.csv '
2. To fit the curves
- Using Standard Least Squares to fit from generated .csv file.
- Specify your .csv file paths in python file for both videos and run the following command.
python3 standard_least_squares.py
In the above problem, we used the least squares method to fit a curve. However, if the data is scattered, this might not be the best choice for curve fitting. In this problem, you are given data for health insurance costs based on the person’s age. There are other fields as well, but you have to fit a line only for age and insurance cost data. The data is given in .csv file format here
- Compute the covariance matrix (from scratch) and find its eigenvalues and eigenvectors. Plot the eigenvectors on the same graph as the data.
- Fit a line to the data using linear least square method, total least square method and RANSAC.
- Run the following command-
python3 curve_fitting.py
Write python code to compute the SVD for given matrix- refer this
- Run the following command-
python3 SVD.py