protected double computeFractionBoundary( float pixelThreshold ) {
		// TODO ignore outer pixels from this computation.  Will require 8 regions (4 corners + top/bottom + left/right)
		final int w = square.width;
		int radius = (int) (w * borderWidthFraction);

		int innerWidth = w-2*radius;
		int total = w*w - innerWidth*innerWidth;
		int count = 0;
		for (int y = 0; y < radius; y++) {
			int indexTop = y*w;
			int indexBottom = (w - radius + y)*w;

			for (int x = 0; x < w; x++) {
				if( square.data[indexTop++] < pixelThreshold )
					count++;
				if( square.data[indexBottom++] < pixelThreshold )
					count++;
			}
		}

		for (int y = radius; y < w-radius; y++) {
			int indexLeft = y*w;
			int indexRight = y*w + w - radius;

			for (int x = 0; x < radius; x++) {
				if( square.data[indexLeft++] < pixelThreshold )
					count++;
				if( square.data[indexRight++] < pixelThreshold )
					count++;
			}
		}

		return count/(double)total;
	}
protected double computeFractionBoundary ( float pixelThreshold ) { final int w = square . width ; int radius = ( int ) ( w * borderWidthFraction ) ; int innerWidth = w - 2 * radius ; int total = w * w - innerWidth * innerWidth ; int count = 0 ; for ( int y = 0 ; y < radius ; y ++ ) { int indexTop = y * w ; int indexBottom = ( w - radius + y ) * w ; for ( int x = 0 ; x < w ; x ++ ) { if ( square . data [ indexTop ++ ] < pixelThreshold ) count ++ ; if ( square . data [ indexBottom ++ ] < pixelThreshold ) count ++ ; } } for ( int y = radius ; y < w - radius ; y ++ ) { int indexLeft = y * w ; int indexRight = y * w + w - radius ; for ( int x = 0 ; x < radius ; x ++ ) { if ( square . data [ indexLeft ++ ] < pixelThreshold ) count ++ ; if ( square . data [ indexRight ++ ] < pixelThreshold ) count ++ ; } } return count / ( double ) total ; }
Computes the fraction of pixels inside the image border which are black
@param pixelThreshold Pixel's less than this value are considered black
@return fraction of border that's black