global static method

UBitMatrix global(
  1. UGrayImage image
)

Implementation

static UBitMatrix global(UGrayImage image) {
  final int threshold = globalThreshold(image);
  final UBitMatrix matrix = UBitMatrix(image.width, image.height);
  for (int y = 0; y < image.height; y++) {
    final int rowStart = y * image.stride;
    for (int x = 0; x < image.width; x++) {
      if (image.data[rowStart + x] <= threshold) matrix.set(x, y);
    }
  }
  return matrix;
}