/* * HomographyHelper * Created by Elliot Woods on 26/11/2010. * Edited by Krisjanis Rijnieks on 23/01/2016 * * Based entirely on arturo castro's homography implementation * Created 08/01/2010, arturo castro * * http://www.openframeworks.cc/forum/viewtopic.php?f=9&t=3121 */ #include "HomographyHelper.h" namespace ofx { namespace piMapper { void HomographyHelper::gaussian_elimination(float *input, int n){ // ported to c from pseudocode in // http://en.wikipedia.org/wiki/Gaussian_elimination float * A = input; int i = 0; int j = 0; int m = n-1; while (i < m && j < n){ // Find pivot in column j, starting in row i: int maxi = i; for(int k = i+1; k fabs(A[maxi*n+j])){ maxi = k; } } if (A[maxi*n+j] != 0){ //swap rows i and maxi, but do not change the value of i if(i!=maxi) for(int k=0;k=0;i--){ for(int j=i+1;j