Skip to content

Commit

Permalink
Function definitons for SVD and Homography calculation. Considering u…
Browse files Browse the repository at this point in the history
…sing numericjs or something similar for this part
  • Loading branch information
ankitrohatgi committed Jul 8, 2018
1 parent 2ac4f8d commit 6044fb7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/javascript/core/mathFunctions.js
Expand Up @@ -147,3 +147,29 @@ wpd.cspline_interp = function(cs, x) {
return a + b*t + c*t*t + d*t*t*t;
}

// Perform a Singular Value Decomposition (SVD) of a mxn matrix:
// mat = [[...], [...], ...] (2D array, row-by-row)
wpd.svd = function(mat) {
// ref: https://en.wikipedia.org/wiki/Singular-value_decomposition#Numerical_approach

let rows = mat.length;
let cols = mat[0].length;

// Step 1: Reduce to a bidiagonal matrix using Householder reflections

// Step 2: QR algorithm for computation of eigenvalues

return {
U: null,
D: null,
V: null
};
};


// Homography matrix for perspective transformations based on pixel coordinates of corner points.
wpd.calculateHomographyMatrix = function(orignalCorners, finalCorners) {
return {
H: null // homography matrix
};
};

0 comments on commit 6044fb7

Please sign in to comment.