protected void initalize ( T input ) { this . input = input ; pixels . resize ( input . width * input . height ) ; initialSegments . reshape ( input . width , input . height ) ; // number of usable pixels that cluster centers can be placed in int numberOfUsable = ( input . width - 2 * BORDER ) * ( input . height - 2 * BORDER ) ; gridInterval = ( int ) Math . sqrt ( numberOfUsable / ( double ) numberOfRegions ) ; if ( gridInterval <= 0 ) throw new IllegalArgumentException ( "Too many regions for an image of this size" ) ; // See equation (1) adjustSpacial = m / gridInterval ; }
prepares all data structures