Skip to content

Commit

Permalink
added v11.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sMaltsevAcuant committed Sep 7, 2022
1 parent 5006018 commit a48477b
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 153 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Acuant Android SDK v11.5.3
**June 2022**
# Acuant Android SDK v11.5.4
**September 2022**

See [https://github.com/Acuant/AndroidSDKV11/releases](https://github.com/Acuant/AndroidSDKV11/releases) for release notes.

Expand Down Expand Up @@ -36,7 +36,7 @@ Before 11.5.0, the SDK was not compiled with AndroidX. The SDK could still be us

## Prerequisites ##

- Supports Android SDK versions 21-31 (compiled with 31)
- Supports Android SDK versions 21-32 (compiled with 32)


## Modules ##
Expand Down Expand Up @@ -116,15 +116,15 @@ The SDK includes the following modules:
- Add the following dependencies

implementation 'com.acuant:acuantcommon:11.5.3'
implementation 'com.acuant:acuantcamera:11.5.3'
implementation 'com.acuant:acuantimagepreparation:11.5.3'
implementation 'com.acuant:acuantdocumentprocessing:11.5.3'
implementation 'com.acuant:acuantechipreader:11.5.3'
implementation 'com.acuant:acuantipliveness:11.5.3'
implementation 'com.acuant:acuantfacematch:11.5.3'
implementation 'com.acuant:acuantfacecapture:11.5.3'
implementation 'com.acuant:acuantpassiveliveness:11.5.3'
implementation 'com.acuant:acuantcommon:11.5.4'
implementation 'com.acuant:acuantcamera:11.5.4'
implementation 'com.acuant:acuantimagepreparation:11.5.4'
implementation 'com.acuant:acuantdocumentprocessing:11.5.4'
implementation 'com.acuant:acuantechipreader:11.5.4'
implementation 'com.acuant:acuantipliveness:11.5.4'
implementation 'com.acuant:acuantfacematch:11.5.4'
implementation 'com.acuant:acuantfacecapture:11.5.4'
implementation 'com.acuant:acuantpassiveliveness:11.5.4'

1. Create an .xml file with the following tags. (If you plan to use bearer tokens to initialize, include only the endpoints.):

Expand Down Expand Up @@ -773,6 +773,7 @@ Must include EchipInitializer() in initialization (See **Initializing the SDK**)
fun setColorBracketHold(value: Int) : DocumentCameraOptionsBuilder
fun setColorBracketCloser(value: Int) : DocumentCameraOptionsBuilder
fun setColorBracketCapturing(value: Int) : DocumentCameraOptionsBuilder
fun setPreventScreenshots(value: Boolean) : DocumentCameraOptionsBuilder
/**
* [ZoomType.Generic] keeps the camera zoomed out to enable you to use nearly all available
* capture space. This is the default setting. Use this setting to capture large
Expand All @@ -798,6 +799,7 @@ Must include EchipInitializer() in initialization (See **Initializing the SDK**)
fun setDefaultBracketMarginHeight(value: Int) : MrzCameraOptionsBuilder
fun setColorCapturing(value: Int) : MrzCameraOptionsBuilder
fun setColorBracketCapturing(value: Int) : MrzCameraOptionsBuilder
fun setPreventScreenshots(value: Boolean) : MrzCameraOptionsBuilder
fun build() : AcuantCameraOptions
}
Expand All @@ -806,6 +808,7 @@ Must include EchipInitializer() in initialization (See **Initializing the SDK**)
fun setTimeToWaitUntilTimeout(value: Int) : BarcodeCameraOptionsBuilder
fun setColorCapturing(value: Int) : BarcodeCameraOptionsBuilder
fun setColorAlign(value: Int) : BarcodeCameraOptionsBuilder
fun setPreventScreenshots(value: Boolean) : BarcodeCameraOptionsBuilder
fun build() : AcuantCameraOptions
}

Expand Down
18 changes: 9 additions & 9 deletions acuantcamera/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

android {
compileSdkVersion 31
compileSdkVersion 32

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 32
}

buildTypes {
Expand All @@ -33,16 +33,16 @@ android {
}
dependencies {
// Kotlin lang
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'

// App compat and UI things
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

// CameraX library
def camerax_version = '1.1.0-beta02'
def camerax_version = '1.1.0'
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
Expand All @@ -52,6 +52,6 @@ dependencies {
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'com.google.mlkit:barcode-scanning:17.0.2'
implementation 'com.rmtheis:tess-two:9.1.0'
implementation 'com.acuant:acuantcommon:11.5.3'
implementation 'com.acuant:acuantimagepreparation:11.5.3'
implementation 'com.acuant:acuantcommon:11.5.4'
implementation 'com.acuant:acuantimagepreparation:11.5.4'
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.acuant.acuantcamera.camera

import android.content.Intent
import android.os.Bundle
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import com.acuant.acuantcamera.R
Expand All @@ -22,8 +23,6 @@ class AcuantCameraActivity: AppCompatActivity(), ICameraActivityFinish {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityCameraBinding.inflate(layoutInflater)
setContentView(binding.root)
hideTopMenu()

val unserializedOptions = intent.getSerializableExtra(ACUANT_EXTRA_CAMERA_OPTIONS)

Expand All @@ -33,7 +32,14 @@ class AcuantCameraActivity: AppCompatActivity(), ICameraActivityFinish {
unserializedOptions as AcuantCameraOptions
}

//start the camera if this si the first time the activity is created (camera already exists otherwise)
if (options.preventScreenshots) {
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
}

setContentView(binding.root)
hideTopMenu()

//start the camera if this is the first time the activity is created (camera already exists otherwise)
if (savedInstanceState == null) {
val cameraFragment: AcuantBaseCameraFragment = when (options.cameraMode) {
AcuantCameraOptions.CameraMode.BarcodeOnly -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ internal constructor(
internal val colorBracketHold : Int = Color.YELLOW,
internal val colorBracketCapturing : Int = Color.GREEN,
internal val cardRatio : Float = 0.65f,
internal val preventScreenshots : Boolean = true,
internal val cameraMode: CameraMode = CameraMode.Document,
internal val zoomType: ZoomType = ZoomType.Generic
) : Serializable {
Expand Down Expand Up @@ -59,6 +60,7 @@ internal constructor(
private var colorBracketHold : Int = Color.YELLOW
private var colorBracketCapturing : Int = Color.GREEN
private var zoomType: ZoomType = ZoomType.Generic
private var preventScreenshots : Boolean = true
private val cardRatio : Float = 0.65f

fun setTimeInMsPerDigit(value: Int) : DocumentCameraOptionsBuilder {
Expand Down Expand Up @@ -131,6 +133,11 @@ internal constructor(
return this
}

fun setPreventScreenshots(value: Boolean) : DocumentCameraOptionsBuilder {
preventScreenshots = value
return this
}

@Deprecated("No longer reliant on GMS, option is ignored", ReplaceWith(""))
fun setUseGms(value: Boolean) : DocumentCameraOptionsBuilder {
return this
Expand All @@ -156,9 +163,12 @@ internal constructor(

fun build() : AcuantCameraOptions {
@Suppress("DEPRECATION")
return AcuantCameraOptions(timeInMsPerDigit, digitsToShow, allowBox, autoCapture, bracketLengthInHorizontal,
bracketLengthInVertical, defaultBracketMarginWidth, defaultBracketMarginHeight, colorHold,
colorCapturing, colorBracketAlign, colorBracketCloser, colorBracketHold, colorBracketCapturing, cardRatio, zoomType = zoomType, cameraMode = CameraMode.Document)
return AcuantCameraOptions(timeInMsPerDigit, digitsToShow, allowBox, autoCapture,
bracketLengthInHorizontal, bracketLengthInVertical, defaultBracketMarginWidth,
defaultBracketMarginHeight, colorHold, colorCapturing, colorBracketAlign,
colorBracketCloser, colorBracketHold, colorBracketCapturing, cardRatio,
preventScreenshots = preventScreenshots, zoomType = zoomType,
cameraMode = CameraMode.Document)
}
}

Expand All @@ -168,6 +178,7 @@ internal constructor(
private var digitsToShow : Int = DEFAULT_TIMEOUT_BARCODE
private var colorCapturing : Int = Color.GREEN
private var colorHold : Int = Color.WHITE
private var preventScreenshots : Boolean = true

/**
* Only an aesthetic difference to prevent jarring transition from the camera (default: [DEFAULT_DELAY_BARCODE]).
Expand Down Expand Up @@ -198,11 +209,16 @@ internal constructor(
return this
}

fun setPreventScreenshots(value: Boolean) : BarcodeCameraOptionsBuilder {
preventScreenshots = value
return this
}

fun build() : AcuantCameraOptions {
@Suppress("DEPRECATION")
return AcuantCameraOptions(timeInMsPerDigit = timeInMsPerDigit, digitsToShow = digitsToShow,
colorCapturing = colorCapturing, colorHold = colorHold,
cameraMode = CameraMode.BarcodeOnly)
return AcuantCameraOptions(timeInMsPerDigit = timeInMsPerDigit,
digitsToShow = digitsToShow, colorCapturing = colorCapturing, colorHold = colorHold,
preventScreenshots = preventScreenshots, cameraMode = CameraMode.BarcodeOnly)
}
}

Expand All @@ -223,8 +239,9 @@ internal constructor(
private var colorBracketCloser : Int = Color.RED
private var colorBracketHold : Int = Color.YELLOW
private var colorBracketCapturing : Int = Color.GREEN
private val cardRatio : Float = 0.65f
private var isMrzMode: Boolean = true
private var preventScreenshots : Boolean = true
private val cardRatio : Float = 0.65f

fun setAllowBox(value: Boolean) : MrzCameraOptionsBuilder {
allowBox = value
Expand Down Expand Up @@ -261,11 +278,18 @@ internal constructor(
return this
}

fun setPreventScreenshots(value: Boolean) : MrzCameraOptionsBuilder {
preventScreenshots = value
return this
}

fun build() : AcuantCameraOptions {
@Suppress("DEPRECATION")
return AcuantCameraOptions(timeInMsPerDigit, digitsToShow, allowBox, autoCapture, bracketLengthInHorizontal,
bracketLengthInVertical, defaultBracketMarginWidth, defaultBracketMarginHeight, colorHold,
colorCapturing, colorBracketAlign, colorBracketCloser, colorBracketHold, colorBracketCapturing, cardRatio, cameraMode = CameraMode.Mrz)
return AcuantCameraOptions(timeInMsPerDigit, digitsToShow, allowBox, autoCapture,
bracketLengthInHorizontal, bracketLengthInVertical, defaultBracketMarginWidth,
defaultBracketMarginHeight, colorHold, colorCapturing, colorBracketAlign,
colorBracketCloser, colorBracketHold, colorBracketCapturing, cardRatio,
preventScreenshots = preventScreenshots, cameraMode = CameraMode.Mrz)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ class AcuantBarcodeCameraFragment: AcuantBaseCameraFragment() {
}
frameAnalyzer.disableDocumentDetection()
imageAnalyzer = ImageAnalysis.Builder()
// .setTargetAspectRatio(screenAspectRatio)
.setTargetResolution(Size(1280, 960))
// .setTargetAspectRatio(screenAspectRatio)
.setTargetRotation(rotation)
.build()
.also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.graphics.Point
import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Size
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
Expand Down Expand Up @@ -376,7 +377,8 @@ class AcuantDocCameraFragment: AcuantBaseCameraFragment() {
setTapToCapture()
}
imageAnalyzer = ImageAnalysis.Builder()
.setTargetAspectRatio(screenAspectRatio)
.setTargetResolution(Size(1280, 960))
// .setTargetAspectRatio(screenAspectRatio)
.setTargetRotation(rotation)
.build()
.also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class AcuantMrzCameraFragment: AcuantBaseCameraFragment() {
onMrzDetection(points, result, state)
}
imageAnalyzer = ImageAnalysis.Builder()
.setTargetResolution(Size(960, 1280))
.setTargetResolution(Size(1280, 960))
// .setTargetAspectRatio(screenAspectRatio)
.setTargetRotation(rotation)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ class MrzParser {
// one another. This list can however get expanded if we get definitive misreads happening on
// specific characters
private fun trySubstitutions(phrase: String, checksum: Char, onlyModifyChecksum: Boolean = false): Pair<String, Char> {
val subList = listOf(Pair('O', '0'), Pair('5', 'S'))

//numbers should be second in this list as the order of substitutions will try to sub first
// for second before second for first.
val subList = listOf(Pair('O', '0'), Pair('S', '5'))

if (checkSum(phrase, checksum)) {
return Pair(phrase, checksum)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ object PointsUtils {
internal fun scalePoints(points: Array<Point>, camContainer: ViewGroup?, analyzerSize: Size?, previewSize: ViewGroup?, rectangleView: BaseRectangleView?) : Array<Point> {
if (camContainer != null && previewSize != null && analyzerSize != null) {

val scale: Float = previewSize.height.toFloat() / analyzerSize.width.toFloat()
val yOffset: Int = ((previewSize.width.toFloat() - analyzerSize.height * scale) / 2).toInt()
val scale: Float = max(previewSize.height, previewSize.width).toFloat() / max(analyzerSize.height, analyzerSize.width).toFloat()
val yOffset: Int = ((min(previewSize.height, previewSize.width).toFloat() - min(analyzerSize.height, analyzerSize.width).toFloat() * scale) / 2).toInt()
val xOffset: Int = ((camContainer.height - previewSize.height) / 2)

rectangleView?.setWidth(camContainer.width.toFloat())
Expand Down
20 changes: 10 additions & 10 deletions acuantfacecapture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

android {
compileSdkVersion 31
compileSdkVersion 32

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 32

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
Expand All @@ -29,25 +29,25 @@ android {
}
dependencies {
// Kotlin lang
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'

// App compat and UI things
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

// CameraX library
def camerax_version = '1.1.0-beta02'
def camerax_version = '1.1.0'
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation "androidx.camera:camera-view:$camerax_version"

//acuant specific stuff
implementation 'com.google.mlkit:face-detection:16.1.5'
implementation 'com.acuant:acuantcommon:11.5.3'
implementation 'com.acuant:acuantimagepreparation:11.5.3'
implementation 'com.acuant:acuantcommon:11.5.4'
implementation 'com.acuant:acuantimagepreparation:11.5.4'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
Expand Down
Loading

0 comments on commit a48477b

Please sign in to comment.