当前位置: 首页>>代码示例>>Java>>正文


Java TessBaseAPI.OEM_TESSERACT_ONLY属性代码示例

本文整理汇总了Java中com.googlecode.tesseract.android.TessBaseAPI.OEM_TESSERACT_ONLY属性的典型用法代码示例。如果您正苦于以下问题:Java TessBaseAPI.OEM_TESSERACT_ONLY属性的具体用法?Java TessBaseAPI.OEM_TESSERACT_ONLY怎么用?Java TessBaseAPI.OEM_TESSERACT_ONLY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.googlecode.tesseract.android.TessBaseAPI的用法示例。


在下文中一共展示了TessBaseAPI.OEM_TESSERACT_ONLY属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOcrEngineModeName

/**
 * Returns a string that represents which OCR engine(s) are currently set to be run.
 *
 * @return OCR engine mode
 */
String getOcrEngineModeName() {
    String ocrEngineModeName = "";
    String[] ocrEngineModes = getResources().getStringArray(R.array.ocrenginemodes);
    if (ocrEngineMode == TessBaseAPI.OEM_TESSERACT_ONLY) {
        ocrEngineModeName = ocrEngineModes[0];
    } else if (ocrEngineMode == TessBaseAPI.OEM_CUBE_ONLY) {
        ocrEngineModeName = ocrEngineModes[1];
    } else if (ocrEngineMode == TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED) {
        ocrEngineModeName = ocrEngineModes[2];
    }
    return ocrEngineModeName;
}
 
开发者ID:mercuriete,项目名称:android-mrz-reader,代码行数:17,代码来源:CaptureActivity.java

示例2: initOcrEngine

/**
 * Requests initialization of the OCR engine with the given parameters.
 *
 * @param storageRoot Path to location of the tessdata directory to use
 * @param languageCode Three-letter ISO 639-3 language code for OCR
 */
private void initOcrEngine(File storageRoot, String languageCode) {
  isEngineReady = false;

  // Set up the dialog box for the thermometer-style download progress indicator
  if (dialog != null) {
    dialog.dismiss();
  }
  dialog = new ProgressDialog(this);

  // set the ocrEngineMode to Tesseract
  ocrEngineMode = TessBaseAPI.OEM_TESSERACT_ONLY;

  // Display the name of the OCR engine we're initializing in the indeterminate progress dialog box
  indeterminateDialog = new ProgressDialog(this);
  indeterminateDialog.setTitle(getString(R.string.ocr_engine_init_dialog_wellcome));
  indeterminateDialog.setMessage(getString(R.string.ocr_engine_init_dialog_body));
  indeterminateDialog.setCancelable(false);
  indeterminateDialog.show();

  if (handler != null) {
    handler.quitSynchronously();
  }

  // Start AsyncTask to install language data and init OCR
  baseApi = new TessBaseAPI();
  new OcrInitAsyncTask(this, baseApi, dialog, indeterminateDialog, languageCode, ocrEngineMode)
          .execute(storageRoot.toString());
}
 
开发者ID:daxslab,项目名称:fotorecarga,代码行数:34,代码来源:CaptureActivity.java

示例3: getOcrEngineModeName

/**
 * Returns a string that represents which OCR engine(s) are currently set to be run.
 * 
 * @return OCR engine mode
 */
String getOcrEngineModeName() {
  String ocrEngineModeName = "";
  String[] ocrEngineModes = getResources().getStringArray(R.array.ocrenginemodes);
  if (ocrEngineMode == TessBaseAPI.OEM_TESSERACT_ONLY) {
    ocrEngineModeName = ocrEngineModes[0];
  } else if (ocrEngineMode == TessBaseAPI.OEM_CUBE_ONLY) {
    ocrEngineModeName = ocrEngineModes[1];
  } else if (ocrEngineMode == TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED) {
    ocrEngineModeName = ocrEngineModes[2];
  }
  return ocrEngineModeName;
}
 
开发者ID:Sector67,项目名称:nsa-away,代码行数:17,代码来源:CaptureActivity.java

示例4: retrievePreferences

/**
 * Gets values from shared preferences and sets the corresponding data members in this activity.
 */
private void retrievePreferences() {
    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    // Retrieve from preferences, and set in this Activity, the language preferences
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    setSourceLanguage(prefs.getString(PreferencesActivity.KEY_SOURCE_LANGUAGE_PREFERENCE, CaptureActivity.DEFAULT_SOURCE_LANGUAGE_CODE));
    setTargetLanguage(prefs.getString(PreferencesActivity.KEY_TARGET_LANGUAGE_PREFERENCE, CaptureActivity.DEFAULT_TARGET_LANGUAGE_CODE));
    isTranslationActive = prefs.getBoolean(PreferencesActivity.KEY_TOGGLE_TRANSLATION, false);

    // Retrieve from preferences, and set in this Activity, the capture mode preference
    if (prefs.getBoolean(PreferencesActivity.KEY_CONTINUOUS_PREVIEW, CaptureActivity.DEFAULT_TOGGLE_CONTINUOUS)) {
        isContinuousModeActive = true;
    } else {
        isContinuousModeActive = false;
    }

    // Retrieve from preferences, and set in this Activity, the page segmentation mode preference
    String[] pageSegmentationModes = getResources().getStringArray(R.array.pagesegmentationmodes);
    String pageSegmentationModeName = prefs.getString(PreferencesActivity.KEY_PAGE_SEGMENTATION_MODE, pageSegmentationModes[0]);
    if (pageSegmentationModeName.equals(pageSegmentationModes[0])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_AUTO_OSD;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[1])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_AUTO;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[2])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_BLOCK;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[3])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_CHAR;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[4])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_COLUMN;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[5])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_LINE;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[6])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_WORD;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[7])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_BLOCK_VERT_TEXT;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[8])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SPARSE_TEXT;
    }

    // Retrieve from preferences, and set in this Activity, the OCR engine mode
    String[] ocrEngineModes = getResources().getStringArray(R.array.ocrenginemodes);
    String ocrEngineModeName = prefs.getString(PreferencesActivity.KEY_OCR_ENGINE_MODE, ocrEngineModes[0]);
    if (ocrEngineModeName.equals(ocrEngineModes[0])) {
        ocrEngineMode = TessBaseAPI.OEM_TESSERACT_ONLY;
    } else if (ocrEngineModeName.equals(ocrEngineModes[1])) {
        ocrEngineMode = TessBaseAPI.OEM_CUBE_ONLY;
    } else if (ocrEngineModeName.equals(ocrEngineModes[2])) {
        ocrEngineMode = TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED;
    }

    // Retrieve from preferences, and set in this Activity, the character blacklist and whitelist
    characterBlacklist = OcrCharacterHelper.getBlacklist(prefs, sourceLanguageCodeOcr);
    characterWhitelist = OcrCharacterHelper.getWhitelist(prefs, sourceLanguageCodeOcr);

    prefs.registerOnSharedPreferenceChangeListener(listener);
}
 
开发者ID:mercuriete,项目名称:android-mrz-reader,代码行数:59,代码来源:CaptureActivity.java

示例5: retrievePreferences

/**
 * Gets values from shared preferences and sets the corresponding data members in this activity.
 */
private void retrievePreferences() {
    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    // Retrieve from preferences, and set in this Activity, the language preferences
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    setSourceLanguage(prefs.getString(PreferencesActivity.KEY_SOURCE_LANGUAGE_PREFERENCE, CaptureActivity.DEFAULT_SOURCE_LANGUAGE_CODE));
    setTargetLanguage(prefs.getString(PreferencesActivity.KEY_TARGET_LANGUAGE_PREFERENCE, CaptureActivity.DEFAULT_TARGET_LANGUAGE_CODE));
    isTranslationActive = prefs.getBoolean(PreferencesActivity.KEY_TOGGLE_TRANSLATION, false);

    // Retrieve from preferences, and set in this Activity, the capture mode preference
    if (prefs.getBoolean(PreferencesActivity.KEY_CONTINUOUS_PREVIEW, CaptureActivity.DEFAULT_TOGGLE_CONTINUOUS)) {
        isContinuousModeActive = true;
    } else {
        isContinuousModeActive = false;
    }

    // Retrieve from preferences, and set in this Activity, the page segmentation mode preference
    String[] pageSegmentationModes = getResources().getStringArray(R.array.pagesegmentationmodes);
    String pageSegmentationModeName = prefs.getString(PreferencesActivity.KEY_PAGE_SEGMENTATION_MODE, pageSegmentationModes[0]);
    if (pageSegmentationModeName.equals(pageSegmentationModes[0])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_AUTO_OSD;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[1])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_AUTO;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[2])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_BLOCK;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[3])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_CHAR;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[4])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_COLUMN;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[5])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_LINE;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[6])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_WORD;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[7])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_BLOCK_VERT_TEXT;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[8])) {
        pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SPARSE_TEXT;
    }

    // Retrieve from preferences, and set in this Activity, the OCR engine mode
    String[] ocrEngineModes = getResources().getStringArray(R.array.ocrenginemodes);
    String ocrEngineModeName = prefs.getString(PreferencesActivity.KEY_OCR_ENGINE_MODE, ocrEngineModes[0]);
    if (ocrEngineModeName.equals(ocrEngineModes[0])) {
        ocrEngineMode = TessBaseAPI.OEM_TESSERACT_ONLY;
    } else if (ocrEngineModeName.equals(ocrEngineModes[1])) {
        ocrEngineMode = TessBaseAPI.OEM_CUBE_ONLY;
    } else if (ocrEngineModeName.equals(ocrEngineModes[2])) {
        ocrEngineMode = TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED;
    }

    // Retrieve from preferences, and set in this Activity, the character blacklist and whitelist
    characterBlacklist = OcrCharacterHelper.getBlacklist(prefs, sourceLanguageCodeOcr);
    characterWhitelist = OcrCharacterHelper.getWhitelist(prefs, sourceLanguageCodeOcr);

    prefs.registerOnSharedPreferenceChangeListener(listener);

    beepManager.updatePrefs();
}
 
开发者ID:hujiaweibujidao,项目名称:android-ocr-demo,代码行数:61,代码来源:CaptureActivity.java

示例6: retrievePreferences

/**
 * Gets values from shared preferences and sets the corresponding data members in this activity.
 */
private void retrievePreferences() {
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    
    // Retrieve from preferences, and set in this Activity, the language preferences
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    setSourceLanguage(prefs.getString(PreferencesActivity.KEY_SOURCE_LANGUAGE_PREFERENCE, CaptureActivity.DEFAULT_SOURCE_LANGUAGE_CODE));
    
    // Retrieve from preferences, and set in this Activity, the capture mode preference
    if (prefs.getBoolean(PreferencesActivity.KEY_CONTINUOUS_PREVIEW, CaptureActivity.DEFAULT_TOGGLE_CONTINUOUS)) {
      isContinuousModeActive = true;
    } else {
      isContinuousModeActive = false;
    }

    // Retrieve from preferences, and set in this Activity, the page segmentation mode preference
    String[] pageSegmentationModes = getResources().getStringArray(R.array.pagesegmentationmodes);
    String pageSegmentationModeName = prefs.getString(PreferencesActivity.KEY_PAGE_SEGMENTATION_MODE, pageSegmentationModes[0]);
    if (pageSegmentationModeName.equals(pageSegmentationModes[0])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_AUTO_OSD;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[1])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_AUTO;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[2])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_BLOCK;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[3])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_CHAR;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[4])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_COLUMN;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[5])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_LINE;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[6])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_WORD;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[7])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SINGLE_BLOCK_VERT_TEXT;
    } else if (pageSegmentationModeName.equals(pageSegmentationModes[8])) {
      pageSegmentationMode = TessBaseAPI.PageSegMode.PSM_SPARSE_TEXT;
    }
    
    // Retrieve from preferences, and set in this Activity, the OCR engine mode
    String[] ocrEngineModes = getResources().getStringArray(R.array.ocrenginemodes);
    String ocrEngineModeName = prefs.getString(PreferencesActivity.KEY_OCR_ENGINE_MODE, ocrEngineModes[0]);
    if (ocrEngineModeName.equals(ocrEngineModes[0])) {
      ocrEngineMode = TessBaseAPI.OEM_TESSERACT_ONLY;
    } else if (ocrEngineModeName.equals(ocrEngineModes[1])) {
      ocrEngineMode = TessBaseAPI.OEM_CUBE_ONLY;
    } else if (ocrEngineModeName.equals(ocrEngineModes[2])) {
      ocrEngineMode = TessBaseAPI.OEM_TESSERACT_CUBE_COMBINED;
    }
    
    // Retrieve from preferences, and set in this Activity, the character blacklist and whitelist
    characterBlacklist = OcrCharacterHelper.getBlacklist(prefs, sourceLanguageCodeOcr);
    //characterWhitelist = OcrCharacterHelper.getWhitelist(prefs, sourceLanguageCodeOcr);
    characterWhitelist = "ABCDEFabcdef0123456789";
    
    prefs.registerOnSharedPreferenceChangeListener(listener);
    
    beepManager.updatePrefs();
}
 
开发者ID:Sector67,项目名称:nsa-away,代码行数:60,代码来源:CaptureActivity.java


注:本文中的com.googlecode.tesseract.android.TessBaseAPI.OEM_TESSERACT_ONLY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。