This blog is about sample application for Scanning documents like CamScanner.
Jhansi Karee has published library and demo project like CamScanner develop with OpenCv and NDK.
if you want only scan image and getting result then you can use library of Jhansi Karee.
Below are the steps to use library for Scanning documents.
1. Download Scan Library.
1. Create new project.
2. Go to File -> New -> Import Module.
3. Now write below Intent code from button where you want to start Scanning process.
Intent intent = new Intent(this, ScanActivity.class);
startActivityForResult(intent, REQUEST_CODE);
*where REQUEST_CODE is any integer value.
4. write below OnActivityResult code to get URI of Image.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) {
Uri uri = data.getExtras().getParcelable(ScanConstants.SCANNED_RESULT);
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), uri);
getContentResolver().delete(uri, null, null);
// set bitmap to your View here.
} catch (IOException e) {
e.printStackTrace();
}
}
}
All Done here...
If you want to integrate this feature in your application rather then using as a library then I will write it in upcoming blog that how we can use this with our code.
Happy Coding :D
1 Comment(s)