React Native OCR - v0.11.0
    Preparing search index...

    Function cropTensor

    • Copies an axis-aligned region of a uint8 [height, width, channels] image tensor into a new tensor.

      The box is snapped outwards to whole pixels and clamped to the image, so a detector's fractional region can be passed as is; the result has shape [ymax - ymin, xmax - xmin, channels] after that adjustment. The caller owns both tensors.

      Parameters

      • image: Tensor

        The image to crop.

      • box: {} & Readonly<{}>

        The region in image pixels, xyxy format.

      Returns Tensor

      A newly allocated tensor holding the region.

      With code INVALID_ARGUMENT when image is not a uint8 rank-3 tensor or the box does not intersect it.