[英]How to fetch (extract) text from image which is in gallery and search that text - Android?
try {
TextRecognizer txtRecognizer = new TextRecognizer.Builder(getApplicationContext()).build();
if (!txtRecognizer.isOperational()) {
} else {
Frame frame = new Frame.Builder().setBitmap(bitmap).build();
SparseArray items = txtRecognizer.detect(frame);
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < items.size(); i++) {
TextBlock item = (TextBlock) items.valueAt(i);
strBuilder.append(item.getValue());
}
Log.d("My Text : ", strBuilder.toString() + " okok");
}
} catch (Exception e) {
e.printStackTrace();
}
首先你需要創建一個Demo
Android 上的光學字符識別 – OCR
從圖像中獲取文本。
這里發布了一些有用的鏈接:-
1.安卓OCR庫
2. https://github.com/abbyysdk/ocrsdk.com
3. http://www.truiton.com/2016/11/optical-character-recognition-android-ocr/
4. https://github.com/renard314/textfairy
5. https://github.com/rmtheis/android-ocr
6. https://github.com/priyankvex/Easy-Ocr-Scanner-Android
你從互聯網上得到的許多例子只是谷歌。 希望這對你有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.