예제 #1
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());
  }
예제 #2
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());
  }