How to extract only selected text fields from image with OCR in android
up vote
1
down vote
favorite
Am new to android programming i have developed one application in which i need to extract text from image/scanned image etc. i achieved that using Google OCR api below is the sample code.
In my case i want to extract only name, email,mobile, address etc, how can i achieve that can anyone please look into it and also is it possible to extract telugu language text?
Here is my sample code.
This code is for getting text from image using OCR.
@Override
public boolean onOptionsItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.actionCamera:
OCRCapture.Builder(this)
.setUseFlash(false)
.setAutoFocus(true)
.buildWithRequestCode(CAMERA_SCAN_TEXT);
break;
case R.id.actionPhoto:
if (hasPermission())
pickImage();
else
getPermission();
break;
return super.onOptionsItemSelected(item);
And this code is to display the extracted text on ActivityResult:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
super.onActivityResult(requestCode, resultCode, data);
if (data != null)
if (requestCode == CAMERA_SCAN_TEXT)
if (resultCode == CommonStatusCodes.SUCCESS)
textView.setText(data.getStringExtra(TextBlockObject));
else if (requestCode == LOAD_IMAGE_RESULTS)
Uri pickedImage = data.getData();
String text = OCRCapture.Builder(this).getTextFromUri(pickedImage);
textView.setText(text);
android ocr image-recognition
add a comment |
up vote
1
down vote
favorite
Am new to android programming i have developed one application in which i need to extract text from image/scanned image etc. i achieved that using Google OCR api below is the sample code.
In my case i want to extract only name, email,mobile, address etc, how can i achieve that can anyone please look into it and also is it possible to extract telugu language text?
Here is my sample code.
This code is for getting text from image using OCR.
@Override
public boolean onOptionsItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.actionCamera:
OCRCapture.Builder(this)
.setUseFlash(false)
.setAutoFocus(true)
.buildWithRequestCode(CAMERA_SCAN_TEXT);
break;
case R.id.actionPhoto:
if (hasPermission())
pickImage();
else
getPermission();
break;
return super.onOptionsItemSelected(item);
And this code is to display the extracted text on ActivityResult:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
super.onActivityResult(requestCode, resultCode, data);
if (data != null)
if (requestCode == CAMERA_SCAN_TEXT)
if (resultCode == CommonStatusCodes.SUCCESS)
textView.setText(data.getStringExtra(TextBlockObject));
else if (requestCode == LOAD_IMAGE_RESULTS)
Uri pickedImage = data.getData();
String text = OCRCapture.Builder(this).getTextFromUri(pickedImage);
textView.setText(text);
android ocr image-recognition
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Am new to android programming i have developed one application in which i need to extract text from image/scanned image etc. i achieved that using Google OCR api below is the sample code.
In my case i want to extract only name, email,mobile, address etc, how can i achieve that can anyone please look into it and also is it possible to extract telugu language text?
Here is my sample code.
This code is for getting text from image using OCR.
@Override
public boolean onOptionsItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.actionCamera:
OCRCapture.Builder(this)
.setUseFlash(false)
.setAutoFocus(true)
.buildWithRequestCode(CAMERA_SCAN_TEXT);
break;
case R.id.actionPhoto:
if (hasPermission())
pickImage();
else
getPermission();
break;
return super.onOptionsItemSelected(item);
And this code is to display the extracted text on ActivityResult:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
super.onActivityResult(requestCode, resultCode, data);
if (data != null)
if (requestCode == CAMERA_SCAN_TEXT)
if (resultCode == CommonStatusCodes.SUCCESS)
textView.setText(data.getStringExtra(TextBlockObject));
else if (requestCode == LOAD_IMAGE_RESULTS)
Uri pickedImage = data.getData();
String text = OCRCapture.Builder(this).getTextFromUri(pickedImage);
textView.setText(text);
android ocr image-recognition
Am new to android programming i have developed one application in which i need to extract text from image/scanned image etc. i achieved that using Google OCR api below is the sample code.
In my case i want to extract only name, email,mobile, address etc, how can i achieve that can anyone please look into it and also is it possible to extract telugu language text?
Here is my sample code.
This code is for getting text from image using OCR.
@Override
public boolean onOptionsItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.actionCamera:
OCRCapture.Builder(this)
.setUseFlash(false)
.setAutoFocus(true)
.buildWithRequestCode(CAMERA_SCAN_TEXT);
break;
case R.id.actionPhoto:
if (hasPermission())
pickImage();
else
getPermission();
break;
return super.onOptionsItemSelected(item);
And this code is to display the extracted text on ActivityResult:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
super.onActivityResult(requestCode, resultCode, data);
if (data != null)
if (requestCode == CAMERA_SCAN_TEXT)
if (resultCode == CommonStatusCodes.SUCCESS)
textView.setText(data.getStringExtra(TextBlockObject));
else if (requestCode == LOAD_IMAGE_RESULTS)
Uri pickedImage = data.getData();
String text = OCRCapture.Builder(this).getTextFromUri(pickedImage);
textView.setText(text);
android ocr image-recognition
android ocr image-recognition
asked 2 days ago
santosh nani
337
337
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206141%2fhow-to-extract-only-selected-text-fields-from-image-with-ocr-in-android%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password