private int [ ] [ ] houghTransformation ( boolean [ ] [ ] mat ) { final int xres = mat . length , yres = mat [ 0 ] . length ; final double tscale = STEPS * .66 / ( xres + yres ) ; final int [ ] [ ] ret = new int [ STEPS ] [ STEPS ] ; for ( int x = 0 ; x < mat . length ; x ++ ) { final boolean [ ] row = mat [ x ] ; for ( int y = 0 ; y < mat [ 0 ] . length ; y ++ ) { if ( row [ y ] ) { for ( int i = 0 ; i < STEPS ; i ++ ) { final int d = ( STEPS >> 1 ) + ( int ) ( tscale * ( x * table . cos ( i ) + y * table . sin ( i ) ) ) ; if ( d > 0 && d < STEPS ) { ret [ d ] [ i ] ++ ; } } } } } return ret ; }
Perform a hough transformation on the binary image in mat .