private boolean rotateUntilInLowerCorner ( Result result ) { // sanity check corners. There should only be one exactly one black final int topLeft = getTotalGridElements ( ) - gridWidth ; final int topRight = getTotalGridElements ( ) - 1 ; final int bottomLeft = 0 ; final int bottomRight = gridWidth - 1 ; if ( classified [ bottomLeft ] + classified [ bottomRight ] + classified [ topRight ] + classified [ topLeft ] != 1 ) return true ; // Rotate until the black corner is in the lower left hand corner on the image. // remember that origin is the top left corner result . rotation = 0 ; while ( classified [ topLeft ] != 1 ) { result . rotation ++ ; rotateClockWise ( ) ; } return false ; }
Rotate the pattern until the black corner is in the lower right . Sanity check to make sure there is only one black corner