/** * Applies this filter to estimate 2-D structure tensors. * @param x input array for 2-D image. * @return structure tensors. */ public EigenTensors2 applyForTensors(float[][] x) { int n1 = x[0].length; int n2 = x.length; float[][] u1 = new float[n2][n1]; float[][] u2 = new float[n2][n1]; float[][] eu = new float[n2][n1]; float[][] ev = new float[n2][n1]; apply(x, null, u1,u2, null,null, eu,ev, null); return new EigenTensors2(u1,u2,eu,ev); }
private static void testRandom(double errorAngle, double errorCoeff) { int n1 = 13, n2 = 14; EigenTensors2 et = new EigenTensors2(n1,n2); for (int i2=0; i2<n2; ++i2) { for (int i1=0; i1<n1; ++i1) { float[] a = makeRandomEigenvalues(); float[] u = makeRandomEigenvector(); et.setEigenvalues(i1,i2,a); et.setEigenvectorU(i1,i2,u); float[] c; c = et.getEigenvectorU(i1,i2); checkEigenvectors(u,c,errorAngle); c = et.getEigenvalues(i1,i2); checkEigenvalues(c,a,errorCoeff); et.setTensor(i1,i2,et.getTensor(i1,i2)); c = et.getEigenvectorU(i1,i2); checkEigenvectors(u,c,errorAngle); c = et.getEigenvalues(i1,i2); checkEigenvalues(c,a,errorCoeff); } } }