@trustchex/react-native-sdk 1.360.0 → 1.361.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/Shared/Components/FaceCamera.js +6 -3
- package/lib/module/Shared/Components/IdentityDocumentCamera.js +11 -3
- package/lib/module/Shared/Config/camera-enhancement.config.js +11 -12
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Config/camera-enhancement.config.d.ts +10 -10
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Shared/Components/FaceCamera.tsx +6 -3
- package/src/Shared/Components/IdentityDocumentCamera.tsx +18 -3
- package/src/Shared/Config/camera-enhancement.config.ts +6 -6
- package/src/version.ts +1 -1
|
@@ -19,9 +19,9 @@ const {
|
|
|
19
19
|
const {
|
|
20
20
|
OpenCVModule
|
|
21
21
|
} = NativeModules;
|
|
22
|
-
const MIN_BRIGHTNESS_THRESHOLD =
|
|
22
|
+
const MIN_BRIGHTNESS_THRESHOLD = 60;
|
|
23
23
|
const BLUR_VARIANCE_THRESHOLD = 60;
|
|
24
|
-
const REGION_BRIGHTNESS_THRESHOLD =
|
|
24
|
+
const REGION_BRIGHTNESS_THRESHOLD = 50;
|
|
25
25
|
const FaceCamera = ({
|
|
26
26
|
onFacesDetected,
|
|
27
27
|
onCameraInitialized,
|
|
@@ -156,7 +156,7 @@ const FaceCamera = ({
|
|
|
156
156
|
const isBright = avgBrightness >= MIN_BRIGHTNESS_THRESHOLD;
|
|
157
157
|
|
|
158
158
|
// Check brightness in the region of interest (circular preview area)
|
|
159
|
-
let isRegionBright =
|
|
159
|
+
let isRegionBright = false;
|
|
160
160
|
if (previewRect && base64Image && OpenCVModule) {
|
|
161
161
|
try {
|
|
162
162
|
// Scale preview rect from screen coordinates to frame coordinates
|
|
@@ -169,7 +169,10 @@ const FaceCamera = ({
|
|
|
169
169
|
isRegionBright = await OpenCVModule.isCircularRegionBright(base64Image, regionMinX, regionMinY, regionWidth, regionHeight, REGION_BRIGHTNESS_THRESHOLD);
|
|
170
170
|
} catch (error) {
|
|
171
171
|
debugWarn('FaceCamera', 'Region brightness check failed:', error);
|
|
172
|
+
isRegionBright = isBright;
|
|
172
173
|
}
|
|
174
|
+
} else {
|
|
175
|
+
isRegionBright = isBright;
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
// Check for blur using OpenCV Laplacian variance
|
|
@@ -24,7 +24,7 @@ const HOLOGRAM_IMAGE_COUNT = 12;
|
|
|
24
24
|
const HOLOGRAM_DETECTION_THRESHOLD = 1000; // Lowered for better sensitivity while still filtering noise
|
|
25
25
|
const HOLOGRAM_DETECTION_RETRY_COUNT = 3; // More attempts but faster each (~1s per attempt)
|
|
26
26
|
const SECOND_FACE_DETECTION_RETRY_COUNT = 10;
|
|
27
|
-
const MIN_BRIGHTNESS_THRESHOLD =
|
|
27
|
+
const MIN_BRIGHTNESS_THRESHOLD = 45;
|
|
28
28
|
const MAX_CONSECUTIVE_QUALITY_FAILURES = 30;
|
|
29
29
|
const IdentityDocumentCamera = ({
|
|
30
30
|
onlyMRZScan,
|
|
@@ -1178,7 +1178,15 @@ const IdentityDocumentCamera = ({
|
|
|
1178
1178
|
}
|
|
1179
1179
|
const avgBrightness = brightnessHistory.current.reduce((a, b) => a + b, 0) / brightnessHistory.current.length;
|
|
1180
1180
|
const isOverallBright = avgBrightness >= MIN_BRIGHTNESS_THRESHOLD;
|
|
1181
|
-
|
|
1181
|
+
|
|
1182
|
+
// Check brightness in center region (area of interest)
|
|
1183
|
+
let isRegionBright = false;
|
|
1184
|
+
try {
|
|
1185
|
+
isRegionBright = await OpenCVModule.isRectangularRegionBright(base64Image, Math.round(frame.width * 0.2), Math.round(frame.height * 0.2), Math.round(frame.width * 0.6), Math.round(frame.height * 0.6), MIN_BRIGHTNESS_THRESHOLD);
|
|
1186
|
+
} catch (error) {
|
|
1187
|
+
isRegionBright = isOverallBright;
|
|
1188
|
+
}
|
|
1189
|
+
setIsBrightnessLow(!isRegionBright);
|
|
1182
1190
|
|
|
1183
1191
|
// Check blur only in center region (area of interest) to avoid false positives
|
|
1184
1192
|
// from iOS depth-of-field background blur
|
|
@@ -1204,7 +1212,7 @@ const IdentityDocumentCamera = ({
|
|
|
1204
1212
|
}
|
|
1205
1213
|
|
|
1206
1214
|
// Only proceed if image quality is acceptable
|
|
1207
|
-
const hasAcceptableQuality =
|
|
1215
|
+
const hasAcceptableQuality = isRegionBright && isNotBlurry;
|
|
1208
1216
|
|
|
1209
1217
|
// Store quality metrics in ref for access in handleFaceAndText callback
|
|
1210
1218
|
lastFrameQuality.current = {
|
|
@@ -14,30 +14,29 @@ export const ENHANCEMENT_CONFIG = {
|
|
|
14
14
|
brightness: {
|
|
15
15
|
thresholds: {
|
|
16
16
|
general: {
|
|
17
|
-
low:
|
|
18
|
-
high:
|
|
19
|
-
target:
|
|
17
|
+
low: 60,
|
|
18
|
+
high: 140,
|
|
19
|
+
target: 100
|
|
20
20
|
},
|
|
21
21
|
faceDetection: {
|
|
22
|
-
low:
|
|
23
|
-
high:
|
|
24
|
-
target:
|
|
22
|
+
low: 70,
|
|
23
|
+
high: 140,
|
|
24
|
+
target: 105
|
|
25
25
|
},
|
|
26
26
|
mrzScanning: {
|
|
27
|
-
low:
|
|
28
|
-
high:
|
|
29
|
-
target:
|
|
27
|
+
low: 65,
|
|
28
|
+
high: 150,
|
|
29
|
+
target: 100
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
adaptiveStep: true,
|
|
33
33
|
maxStepSize: 2,
|
|
34
|
-
|
|
35
|
-
hysteresis: 5 // Dead zone to prevent oscillation
|
|
34
|
+
hysteresis: 5
|
|
36
35
|
},
|
|
37
36
|
contrast: {
|
|
38
37
|
enabled: true,
|
|
39
38
|
clahe: {
|
|
40
|
-
clipLimit:
|
|
39
|
+
clipLimit: 1.5,
|
|
41
40
|
tileGridSize: [8, 8]
|
|
42
41
|
},
|
|
43
42
|
applyWhen: {
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FaceCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/FaceCamera.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,mBAAmB,CAAC;AAa3B,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,EAAE;QACN,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,CACf,KAAK,EAAE,IAAI,EAAE,EACb,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,OAAO,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,KAChB,IAAI,CAAC;IACV,mBAAmB,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC7D,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,wDAIjB,eAAe,
|
|
1
|
+
{"version":3,"file":"FaceCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/FaceCamera.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,mBAAmB,CAAC;AAa3B,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,EAAE;QACN,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,CACf,KAAK,EAAE,IAAI,EAAE,EACb,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,OAAO,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,KAChB,IAAI,CAAC;IACV,mBAAmB,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAC7D,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,wDAIjB,eAAe,4CA2SjB,CAAC;AA6BF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityDocumentCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/IdentityDocumentCamera.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAcpD,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,SAAS,CAAC;IACtB,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,gBAAgB,GAAG,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEnD,KAAK,SAAS,GAAG;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,gBAAgB,EAAE,gBAAgB;IAClC,QAAQ,EAAE,YAAY;IACtB,SAAS,EAAE,SAAS;IACpB,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5B,QAAQ,EAAE,MAAM;CACjB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,mBAAmB,EAAE,gBAAgB;IACrC,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EACR,gBAAgB,GAChB,UAAU,GACV,oBAAoB,GACpB,eAAe,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,yBAAyB,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACvE;AA4BD,QAAA,MAAM,sBAAsB,GAAI,6CAG7B,2BAA2B,
|
|
1
|
+
{"version":3,"file":"IdentityDocumentCamera.d.ts","sourceRoot":"","sources":["../../../../../src/Shared/Components/IdentityDocumentCamera.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAcpD,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,SAAS,CAAC;IACtB,iBAAiB,EAAE,gBAAgB,CAAC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,gBAAgB,GAAG,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEnD,KAAK,SAAS,GAAG;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,gBAAgB,EAAE,gBAAgB;IAClC,QAAQ,EAAE,YAAY;IACtB,SAAS,EAAE,SAAS;IACpB,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5B,QAAQ,EAAE,MAAM;CACjB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,mBAAmB,EAAE,gBAAgB;IACrC,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,MAAM;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EACR,gBAAgB,GAChB,UAAU,GACV,oBAAoB,GACpB,eAAe,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,yBAAyB,EAAE,CAAC,WAAW,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACvE;AA4BD,QAAA,MAAM,sBAAsB,GAAI,6CAG7B,2BAA2B,4CAk1G7B,CAAC;AA0LF,eAAe,sBAAsB,CAAC"}
|
|
@@ -11,19 +11,19 @@ export declare const ENHANCEMENT_CONFIG: {
|
|
|
11
11
|
readonly brightness: {
|
|
12
12
|
readonly thresholds: {
|
|
13
13
|
readonly general: {
|
|
14
|
-
readonly low:
|
|
15
|
-
readonly high:
|
|
16
|
-
readonly target:
|
|
14
|
+
readonly low: 60;
|
|
15
|
+
readonly high: 140;
|
|
16
|
+
readonly target: 100;
|
|
17
17
|
};
|
|
18
18
|
readonly faceDetection: {
|
|
19
|
-
readonly low:
|
|
20
|
-
readonly high:
|
|
21
|
-
readonly target:
|
|
19
|
+
readonly low: 70;
|
|
20
|
+
readonly high: 140;
|
|
21
|
+
readonly target: 105;
|
|
22
22
|
};
|
|
23
23
|
readonly mrzScanning: {
|
|
24
|
-
readonly low:
|
|
25
|
-
readonly high:
|
|
26
|
-
readonly target:
|
|
24
|
+
readonly low: 65;
|
|
25
|
+
readonly high: 150;
|
|
26
|
+
readonly target: 100;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
readonly adaptiveStep: true;
|
|
@@ -33,7 +33,7 @@ export declare const ENHANCEMENT_CONFIG: {
|
|
|
33
33
|
readonly contrast: {
|
|
34
34
|
readonly enabled: true;
|
|
35
35
|
readonly clahe: {
|
|
36
|
-
readonly clipLimit:
|
|
36
|
+
readonly clipLimit: 1.5;
|
|
37
37
|
readonly tileGridSize: [number, number];
|
|
38
38
|
};
|
|
39
39
|
readonly applyWhen: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.361.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -26,9 +26,9 @@ import { Dimensions } from 'react-native';
|
|
|
26
26
|
|
|
27
27
|
const { width: windowWidth, height: windowHeight } = Dimensions.get('window');
|
|
28
28
|
const { OpenCVModule } = NativeModules;
|
|
29
|
-
const MIN_BRIGHTNESS_THRESHOLD =
|
|
29
|
+
const MIN_BRIGHTNESS_THRESHOLD = 60;
|
|
30
30
|
const BLUR_VARIANCE_THRESHOLD = 60;
|
|
31
|
-
const REGION_BRIGHTNESS_THRESHOLD =
|
|
31
|
+
const REGION_BRIGHTNESS_THRESHOLD = 50;
|
|
32
32
|
|
|
33
33
|
export type Face = {
|
|
34
34
|
bounds: {
|
|
@@ -222,7 +222,7 @@ const FaceCamera = ({
|
|
|
222
222
|
const isBright = avgBrightness >= MIN_BRIGHTNESS_THRESHOLD;
|
|
223
223
|
|
|
224
224
|
// Check brightness in the region of interest (circular preview area)
|
|
225
|
-
let isRegionBright =
|
|
225
|
+
let isRegionBright = false;
|
|
226
226
|
if (previewRect && base64Image && OpenCVModule) {
|
|
227
227
|
try {
|
|
228
228
|
// Scale preview rect from screen coordinates to frame coordinates
|
|
@@ -243,7 +243,10 @@ const FaceCamera = ({
|
|
|
243
243
|
);
|
|
244
244
|
} catch (error) {
|
|
245
245
|
debugWarn('FaceCamera', 'Region brightness check failed:', error);
|
|
246
|
+
isRegionBright = isBright;
|
|
246
247
|
}
|
|
248
|
+
} else {
|
|
249
|
+
isRegionBright = isBright;
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
// Check for blur using OpenCV Laplacian variance
|
|
@@ -122,7 +122,7 @@ const HOLOGRAM_IMAGE_COUNT = 12;
|
|
|
122
122
|
const HOLOGRAM_DETECTION_THRESHOLD = 1000; // Lowered for better sensitivity while still filtering noise
|
|
123
123
|
const HOLOGRAM_DETECTION_RETRY_COUNT = 3; // More attempts but faster each (~1s per attempt)
|
|
124
124
|
const SECOND_FACE_DETECTION_RETRY_COUNT = 10;
|
|
125
|
-
const MIN_BRIGHTNESS_THRESHOLD =
|
|
125
|
+
const MIN_BRIGHTNESS_THRESHOLD = 45;
|
|
126
126
|
const MAX_CONSECUTIVE_QUALITY_FAILURES = 30;
|
|
127
127
|
|
|
128
128
|
const IdentityDocumentCamera = ({
|
|
@@ -1897,7 +1897,22 @@ const IdentityDocumentCamera = ({
|
|
|
1897
1897
|
brightnessHistory.current.length;
|
|
1898
1898
|
const isOverallBright = avgBrightness >= MIN_BRIGHTNESS_THRESHOLD;
|
|
1899
1899
|
|
|
1900
|
-
|
|
1900
|
+
// Check brightness in center region (area of interest)
|
|
1901
|
+
let isRegionBright = false;
|
|
1902
|
+
try {
|
|
1903
|
+
isRegionBright = await OpenCVModule.isRectangularRegionBright(
|
|
1904
|
+
base64Image,
|
|
1905
|
+
Math.round(frame.width * 0.2),
|
|
1906
|
+
Math.round(frame.height * 0.2),
|
|
1907
|
+
Math.round(frame.width * 0.6),
|
|
1908
|
+
Math.round(frame.height * 0.6),
|
|
1909
|
+
MIN_BRIGHTNESS_THRESHOLD
|
|
1910
|
+
);
|
|
1911
|
+
} catch (error) {
|
|
1912
|
+
isRegionBright = isOverallBright;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
setIsBrightnessLow(!isRegionBright);
|
|
1901
1916
|
|
|
1902
1917
|
// Check blur only in center region (area of interest) to avoid false positives
|
|
1903
1918
|
// from iOS depth-of-field background blur
|
|
@@ -1921,7 +1936,7 @@ const IdentityDocumentCamera = ({
|
|
|
1921
1936
|
}
|
|
1922
1937
|
|
|
1923
1938
|
// Only proceed if image quality is acceptable
|
|
1924
|
-
const hasAcceptableQuality =
|
|
1939
|
+
const hasAcceptableQuality = isRegionBright && isNotBlurry;
|
|
1925
1940
|
|
|
1926
1941
|
// Store quality metrics in ref for access in handleFaceAndText callback
|
|
1927
1942
|
lastFrameQuality.current = {
|
|
@@ -12,19 +12,19 @@ export const ENHANCEMENT_CONFIG = {
|
|
|
12
12
|
|
|
13
13
|
brightness: {
|
|
14
14
|
thresholds: {
|
|
15
|
-
general: { low:
|
|
16
|
-
faceDetection: { low:
|
|
17
|
-
mrzScanning: { low:
|
|
15
|
+
general: { low: 60, high: 140, target: 100 },
|
|
16
|
+
faceDetection: { low: 70, high: 140, target: 105 },
|
|
17
|
+
mrzScanning: { low: 65, high: 150, target: 100 },
|
|
18
18
|
},
|
|
19
19
|
adaptiveStep: true,
|
|
20
|
-
maxStepSize: 2,
|
|
21
|
-
hysteresis: 5,
|
|
20
|
+
maxStepSize: 2,
|
|
21
|
+
hysteresis: 5,
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
contrast: {
|
|
25
25
|
enabled: true,
|
|
26
26
|
clahe: {
|
|
27
|
-
clipLimit:
|
|
27
|
+
clipLimit: 1.5,
|
|
28
28
|
tileGridSize: [8, 8] as [number, number],
|
|
29
29
|
},
|
|
30
30
|
applyWhen: {
|
package/src/version.ts
CHANGED