cropGray static method

UGrayImage cropGray(
  1. UGrayImage image,
  2. Rect normalizedRegion
)

Crops a frame to a normalized region before decoding, the cheapest way to make scanning faster and more accurate.

Implementation

static UGrayImage cropGray(UGrayImage image, Rect normalizedRegion) {
  final int left = (normalizedRegion.left * image.width).round();
  final int top = (normalizedRegion.top * image.height).round();
  final int width = (normalizedRegion.width * image.width).round();
  final int height = (normalizedRegion.height * image.height).round();
  return image.crop(left, top, width, height);
}