private static double getHighThreshold(ImageProcessor gradient, double percentNotEdges){
		gradient.setHistogramSize(64);
		int[] histogram = gradient.getHistogram();
		long cumulative = 0;
		long totalNotEdges = Math.round(gradient.getHeight()*gradient.getWidth()*percentNotEdges);
		int buckets = 0;
		for(; buckets < 64 && cumulative < totalNotEdges; buckets++){
			cumulative += histogram[buckets];
		}
		return buckets/64.0;
	}