Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Scan document like CS Scanner

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 283
    Comment on it

    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)

  • Hi!

    I only be able to use your solution, when I add to scan.cpp the following codes:

    extern "C" {
        JNIEXPORT jobject JNICALL Java_[MY PACKAGE]_ScanActivity_getScannedBitmap([METHOD PARAMS]);
        JNIEXPORT jobject JNICALL Java_[MY PACKAGE]_ScanActivity_getMagicColorBitmap([METHOD PARAMS]);
        JNIEXPORT jobject JNICALL Java_[MY PACKAGE]_ScanActivity_getBWBitmap([METHOD PARAMS]);
        JNIEXPORT jobject JNICALL Java_[MY PACKAGE]_ScanActivity_getGrayBitmap([METHOD PARAMS]);
        JNIEXPORT jfloatArray JNICALL Java_[MY PACKAGE]_ScanActivity_getPoints([METHOD PARAMS]);
    };

    I hope this helps anothers with the same needs.
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: