Skip to content

Curve fittings using Least Squares, Total Least Squares and RANSAC. Homography and Singular Value Decomposition

Notifications You must be signed in to change notification settings

karanamrahul/Curve-Fitting-RANSAC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Perception

Curve Fittings using Least squares, Total Least Squares and RANSAC.

Finding Homography Matrix using Singular Value Decompositon

├── Code
|  ├── Curve_fitting.py
|  ├── Homography_SVD.py
|  ├── balltrack.py
|  ├── Covariance.py
├── Docs
|  ├── ball_video1.mp4
|  ├── ball_video2.mp4
|  ├── dataset.xlsx
|  ├── Report.pdf
├── Results
|  |  ├── .png files

Problem 1

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:

  1. 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.

Steps to Run the code

git clone --recursive https://github.com/karanamrahul/Perception.git 
cd Perception
python3 balltrack.py 

Results

Problem 2

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 and can be downloaded from here(dataset.xlsx).

  1. Compute the covariance matrix (from scratch) and find its eigenvalues and eigenvectors. Plot the eigenvectors on the same graph as the data. Refer to this article for better understanding.

  2. Fit a line to the data using linear least square method, total least square method and RANSAC. Plot the result for each method and explain drawbacks/advantages for each.

Steps to Run the code

git clone --recursive https://github.com/karanamrahul/Perception.git 
cd Perception
python3 Covariance.py 
python3 Curve_fitting.py

Results

Covariance

alt test

Least Squares

alt test

Total Least Squares

alt test

RANSAC

alt test

Problem 3

alt test

Compute Homography Matrix for the below given points.

Compute SVD of the Matrix A using python.

Steps to Run the code

git clone --recursive https://github.com/karanamrahul/Perception.git 
cd Perception
python3 Homography_SVD.py 


About

Curve fittings using Least Squares, Total Least Squares and RANSAC. Homography and Singular Value Decomposition

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages