Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.liltof:AndroidScannerDemo:3.2'
}
dependencies {
implementation("com.github.liltof:AndroidScannerDemo:3.2")
}
<dependency>
<groupId>com.github.liltof</groupId>
<artifactId>AndroidScannerDemo</artifactId>
<version>3.2</version>
</dependency>
libraryDependencies += "com.github.liltof" % "AndroidScannerDemo" % "3.2"
:dependencies [[com.github.liltof/AndroidScannerDemo "3.2"]]
ScanLibrary is an android document scanning library built on top of OpenCV, using the app you will be able to select the exact edges and crop the document accordingly from the selected 4 edges and change the perspective transformation of the cropped image.
<img width="23%" src="https://raw.githubusercontent.com/andrejlukasevic/AndroidScannerDemo/master/ScanDemoExample/screenshots/a.png" alt="Scan Points" title="Scan Points"</img>
<img height="0" width="8px">
<img width="23%" src="https://raw.githubusercontent.com/andrejlukasevic/AndroidScannerDemo/master/ScanDemoExample/screenshots/b.png" alt="Magic colors" title="Magic colorst"</img>
<img height="0" width="8px">
<img width="23%"src="https://raw.githubusercontent.com/andrejlukasevic/AndroidScannerDemo/master/ScanDemoExample/screenshots/c.png" alt="Palette" title="Palette"></img>
<img height="0" width="8px">
<img width="23%" src="https://raw.githubusercontent.com/andrejlukasevic/AndroidScannerDemo/master/ScanDemoExample/screenshots/d.png" alt="Gray colors" title="Gray colorst"></img>
<img height="0" width="8px">
<img width="23%" src="https://raw.githubusercontent.com/andrejlukasevic/AndroidScannerDemo/master/ScanDemoExample/screenshots/e.png" alt="Normal colors" title="Normal colors"></img>
<img height="0" width="8px">
<img width="23%" src="https://raw.githubusercontent.com/andrejlukasevic/AndroidScannerDemo/master/ScanDemoExample/screenshots/f.png" alt="Rotated Image" title="Rotated Image"></img>
<img height="0" width="8px">
<img width="23%" src="https://raw.githubusercontent.com/andrejlukasevic/AndroidScannerDemo/master/ScanDemoExample/screenshots/g.png" alt="Zoomed Image" title="Zoomed Image"></img>
</div>
- compile 'com.github.andrejlukasevic:document-scanner:4.0.0' // Check for latest version and replace version code
Intent intent = new Intent(this, ScanActivity.class);
intent.putExtra(ScanActivity.EXTRA_BRAND_IMG_RES, R.drawable.ic_crop_white_24dp); // Set image for title icon - optional
intent.putExtra(ScanActivity.EXTRA_TITLE, "Crop Document"); // Set title in action Bar - optional
intent.putExtra(ScanActivity.EXTRA_ACTION_BAR_COLOR, R.color.green); // Set title color - optional
intent.putExtra(ScanActivity.EXTRA_LANGUAGE, "en"); // Set language - optional
startActivityForResult(intent, REQUEST_CODE_SCAN);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_SCAN && resultCode == Activity.RESULT_OK) {
String imgPath = data.getStringExtra(ScanActivity.RESULT_IMAGE_PATH);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(imgPath, options);
viewHolder.image.setImageBitmap(bitmap);
}
}