示例#1
0
  /**
   * Provides an image for Tesseract to recognize. Does not copy the image buffer. The source image
   * must persist until after Recognize or GetUTF8Chars is called.
   *
   * @param bmp bitmap representation of the image
   */
  public void setImage(Bitmap bmp) {
    Pix image = ReadFile.readBitmap(bmp);

    if (image == null) {
      throw new RuntimeException("Failed to read bitmap");
    }

    nativeSetImagePix(image.getNativePix());
  }
示例#2
0
  /**
   * Provides an image for Tesseract to recognize.
   *
   * @param file absolute path to the image file
   */
  public void setImage(File file) {
    Pix image = ReadFile.readFile(file);

    if (image == null) {
      throw new RuntimeException("Failed to read image file");
    }

    nativeSetImagePix(image.getNativePix());
  }
示例#3
0
  /**
   * Provides an image for Tesseract to recognize. Copies the image buffer. The source image may be
   * destroyed immediately after SetImage is called. SetImage clears all recognition results, and
   * sets the rectangle to the full image, so it may be followed immediately by a GetUTF8Text, and
   * it will automatically perform recognition.
   *
   * @param file absolute path to the image file
   */
  public void setImage(File file) {
    if (mRecycled) throw new IllegalStateException();

    Pix image = ReadFile.readFile(file);

    if (image == null) {
      throw new RuntimeException("Failed to read image file");
    }

    nativeSetImagePix(image.getNativePix());
  }
示例#4
0
  /**
   * Provides a Leptonica pix format image for Tesseract to recognize. Clones the pix object. The
   * source image may be destroyed immediately after SetImage is called, but its contents may not be
   * modified.
   *
   * @param image Leptonica pix representation of the image
   */
  public void setImage(Pix image) {
    if (mRecycled) throw new IllegalStateException();

    nativeSetImagePix(image.getNativePix());
  }
示例#5
0
 /**
  * Provides a Leptonica pix format image for Tesseract to recognize. Clones the pix object. The
  * source image may be destroyed immediately after SetImage is called, but its contents may not be
  * modified.
  *
  * @param image Leptonica pix representation of the image
  */
 public void setImage(Pix image) {
   nativeSetImagePix(image.getNativePix());
 }