static void detectAdjacentAndPositionPatterns ( int N , QrCodeCodeWordLocations matrix , FoundFeatures features ) { for ( int foo = 0 ; foo < 2 ; foo ++ ) { for ( int row = 0 ; row < N ; row ++ ) { int index = row * N ; for ( int col = 1 ; col < N ; col ++ , index ++ ) { if ( matrix . data [ index ] == matrix . data [ index + 1 ] ) features . adjacent ++ ; } index = row * N ; for ( int col = 6 ; col < N ; col ++ , index ++ ) { if ( matrix . data [ index ] && ! matrix . data [ index + 1 ] && matrix . data [ index + 2 ] && matrix . data [ index + 3 ] && matrix . data [ index + 4 ] && ! matrix . data [ index + 5 ] && matrix . data [ index + 6 ] ) features . position ++ ; } } CommonOps_BDRM . transposeSquare ( matrix ) ; } // subtract out false positives by the mask applied to position patterns, timing, mode features . adjacent -= 8 * 9 + 2 * 9 * 8 + ( N - 18 ) * 2 ; }
Look for adjacent blocks that are the same color as well as patterns that could be confused for position patterns 1 1 3 1 1 in vertical and horizontal directions