private void minimizeWithGeometricConstraints ( ) { extractEpipoles . setTensor ( solutionN ) ; extractEpipoles . extractEpipoles ( e2 , e3 ) ; // encode the parameters being optimized param [ 0 ] = e2 . x ; param [ 1 ] = e2 . y ; param [ 2 ] = e2 . z ; param [ 3 ] = e3 . x ; param [ 4 ] = e3 . y ; param [ 5 ] = e3 . z ; // adjust the error function for the current inputs errorFunction . init ( ) ; // set up the optimization algorithm optimizer . setFunction ( errorFunction , null ) ; optimizer . initialize ( param , gtol , ftol ) ; // optimize until convergence or the maximum number of iterations UtilOptimize . process ( optimizer , maxIterations ) ; // get the results and compute the trifocal tensor double found [ ] = optimizer . getParameters ( ) ; paramToEpipoles ( found , e2 , e3 ) ; enforce . process ( e2 , e3 , A ) ; enforce . extractSolution ( solutionN ) ; }
Minimize the algebraic error using LM . The two epipoles are the parameters being optimized .