code: public void search( float cx , float cy ) {
  
  		peakX = cx; peakY = cy;
  		setRegion(cx, cy);
  
  		for( int i = 0; i < maxIterations; i++ ) {
  			float total = 0;
  			float sumX = 0, sumY = 0;
  
  			int kernelIndex = 0;
  
  			// see if it can use fast interpolation otherwise use the safer technique
  			if( interpolate.isInFastBounds(x0, y0) &&
  					interpolate.isInFastBounds(x0 + width - 1, y0 + width - 1)) {
  				for( int yy = 0; yy < width; yy++ ) {
  					for( int xx = 0; xx < width; xx++ ) {
  						float w = weights.weightIndex(kernelIndex++);
  						float weight = w*interpolate.get_fast(x0 + xx, y0 + yy);
  						total += weight;
  						sumX += weight*(xx+x0);
  						sumY += weight*(yy+y0);
  					}
  				}
  			} else {
  				for( int yy = 0; yy < width; yy++ ) {
  					for( int xx = 0; xx < width; xx++ ) {
  						float w = weights.weightIndex(kernelIndex++);
  						float weight = w*interpolate.get(x0 + xx, y0 + yy);
  						total += weight;
  						sumX += weight*(xx+x0);
  						sumY += weight*(yy+y0);
  					}
  				}
  			}
  
  			cx = sumX/total;
  			cy = sumY/total;
  
  			setRegion(cx, cy);
  
  			float dx = cx-peakX;
  			float dy = cy-peakY;
  
  			peakX = cx; peakY = cy;
  
  			if( Math.abs(dx) < convergenceTol && Math.abs(dy) < convergenceTol ) {
  				break;
  			}
  		}
  	}
docs: Performs a mean-shift search center at the specified coordinates