public void fixateUndistorted ( ) { if ( controls . size ( ) < 2 ) throw new RuntimeException ( "Not enough control points specified. Found " + controls . size ( ) ) ; for ( int row = 0 ; row < gridRows ; row ++ ) { for ( int col = 0 ; col < gridCols ; col ++ ) { Cache cache = getGrid ( row , col ) ; cache . weights . resize ( controls . size ) ; cache . A . resize ( controls . size ) ; cache . A_s . resize ( controls . size ( ) ) ; float v_x = col ; float v_y = row ; computeWeights ( cache , v_x , v_y ) ; computeAverageP ( cache ) ; model . computeCache ( cache , v_x , v_y ) ; } } }
Precompute the portion of the equation which only concerns the undistorted location of each point on the grid even the current undistorted location of each control point .