protected void updateHistogramX(int x0, int y0, GrayU8 input) { int indexInput = input.startIndex + y0*input.stride + x0-1; for (int y = 0; y < regionWidth; y++) { histogram[input.data[indexInput] & 0xFF]--; histogram[input.data[indexInput+regionWidth] & 0xFF]++; indexInput += input.stride; } otsu.compute(histogram,histogram.length,numPixels); } protected void updateHistogramY(int x0, int y0, GrayU8 input) {
protected void updateHistogramY(int x0, int y0, GrayU8 input) { int offset = regionWidth*input.stride; for (int x = 0; x < regionWidth; x++) { int indexInput = input.startIndex + (y0-1)*input.stride + x0+x; histogram[input.data[indexInput] & 0xFF]--; histogram[input.data[indexInput+offset] & 0xFF]++; } otsu.compute(histogram,histogram.length,numPixels); }
protected void computeHistogram(int x0, int y0, GrayU8 input) { Arrays.fill(histogram,0); for (int y = 0; y < regionWidth; y++) { int indexInput = input.startIndex + (y0+y)*input.stride + x0; for (int x = 0; x < regionWidth; x++) { histogram[input.data[indexInput++] & 0xFF]++; } } otsu.compute(histogram,histogram.length,numPixels); }
otsu.compute(histogram,histogram.length,total);