Skip to content

Credntia/CVScanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CVScanner

An OpenCV based library for Android to scan/crop ID documents or Passports.

Usage

Automatic Crop

The easiest way is to launch the DocumentScannerActivity

CVScanner.startScanner(this, isPassport, REQ_SCAN);

You'll get the path of the scanned image in onActivityResult(int requestCode, int resultCode, Intent data)

if(requestCode == REQ_SCAN && resultCode == RESULT_OK){
  String path = data.getStringExtra(CVScanner.RESULT_IMAGE_PATH);
}

You can use the DocumentScannerFragment too

Fragment fragment = DocumentScannerFragment.instantiate(isScanningPassport);
getSupportFragmentManager().beginTransaction()
        .add(R.id.container, fragment)
        .commit();

The host Activity should implement ImageProcessorCallback to get scanning results.

Manual Crop

The easiest way is to launch the CropImageActivity

CVScanner.startManualCropper(this, currentPhotoUri, REQ_CROP_IMAGE);

You'll get the path to the scanned image in onActivityResult

if(requestCode == REQ_CROP_IMAGE && resultCode == RESULT_OK){
  String path = data.getStringExtra(CVScanner.RESULT_IMAGE_PATH);
}

You can use the ImageCropperFragment too

Fragment fragment = ImageCropperFragment.instantiate(imageUri);
getSupportFragmentManager().beginTransaction()
    .add(R.id.container, fragment)
    .commit();

The host Activity should implement ImageProcessorCallback to get cropping results.

About

An OpenCV based library for Android to scan ID documents or Passports.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages