code: protected void perturbCenter( Cluster c , int x , int y ) {
  		float best = Float.MAX_VALUE;
  		int bestX=0,bestY=0;
  
  		for( int dy = -1; dy <= 1; dy++ ) {
  			for( int dx = -1; dx <= 1; dx++ ) {
  				float d = gradient(x + dx, y + dy);
  				if( d < best ) {
  					best = d;
  					bestX = dx;
  					bestY = dy;
  				}
  			}
  		}
  
  		c.x = x+bestX;
  		c.y = y+bestY;
  		setColor(c.color,x+bestX,y+bestY);
  	}
docs: Set the cluster's center to be the pixel in a 3x3 neighborhood with the smallest gradient