@trustchex/react-native-sdk 1.357.1 → 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.
@@ -780,20 +780,27 @@ class TrustchexCameraView(context: ThemedReactContext) : FrameLayout(context) {
780
780
 
781
781
  @OptIn(ExperimentalGetImage::class)
782
782
  private fun applyCameraSettings() {
783
- // CameraX manages continuous autofocus automatically
784
- // We only need to set initial focus point at center
785
783
  val camera = camera ?: return
784
+ val isFrontCamera = cameraSelector == CameraSelector.DEFAULT_FRONT_CAMERA
786
785
 
787
786
  try {
788
787
  val centerPoint = previewView.meteringPointFactory.createPoint(0.5f, 0.5f)
789
- val afAction = FocusMeteringAction.Builder(
790
- centerPoint,
788
+
789
+ // Front camera: Enable AE/AF/AWB for face detection
790
+ // Back camera: Focus on center for document scanning
791
+ val flags = if (isFrontCamera) {
792
+ FocusMeteringAction.FLAG_AF or FocusMeteringAction.FLAG_AE or FocusMeteringAction.FLAG_AWB
793
+ } else {
791
794
  FocusMeteringAction.FLAG_AF or FocusMeteringAction.FLAG_AE
792
- ).build()
795
+ }
796
+
797
+ val afAction = FocusMeteringAction.Builder(centerPoint, flags)
798
+ .setAutoCancelDuration(5, java.util.concurrent.TimeUnit.SECONDS)
799
+ .build()
793
800
 
794
801
  camera.cameraControl.startFocusAndMetering(afAction)
795
802
  } catch (e: Exception) {
796
- // Silently handle - not critical
803
+ android.util.Log.w("TrustchexCamera", "Failed to apply camera settings: ${e.message}")
797
804
  }
798
805
  }
799
806
  private fun sendFrameEvent(frameData: WritableMap) {
@@ -250,25 +250,27 @@ class TrustchexCameraView: UIView {
250
250
  return AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front)
251
251
  }
252
252
 
253
- // For document/car scanning, prefer cameras with better close-range autofocus.
254
- // Wide-angle cameras can struggle with focus at close distances.
255
- // Priority: Dual Camera > Triple Camera > Wide Angle
256
-
257
- // Try dual camera first (iPhone 7 Plus and later with dual cameras)
253
+ // For document scanning, prefer wide angle camera for all models
254
+ // This provides consistent behavior across iPhone 15, 15 Pro, and other devices
255
+ if let wideAngleCamera = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) {
256
+ print("[TrustchexCamera] Selected Wide Angle camera for document scanning")
257
+ return wideAngleCamera
258
+ }
259
+
260
+ // Fallback: Try dual camera
258
261
  if let dualCamera = AVCaptureDevice.default(.builtInDualCamera, for: .video, position: .back) {
259
- print("[TrustchexCamera] Selected Dual Camera for document scanning (better close-range focus)")
262
+ print("[TrustchexCamera] Selected Dual Camera for document scanning")
260
263
  return dualCamera
261
264
  }
262
-
263
- // Try triple camera (iPhone 11 Pro and later)
265
+
266
+ // Fallback: Try triple camera
264
267
  if let tripleCamera = AVCaptureDevice.default(.builtInTripleCamera, for: .video, position: .back) {
265
- print("[TrustchexCamera] Selected Triple Camera for document scanning (better close-range focus)")
268
+ print("[TrustchexCamera] Selected Triple Camera for document scanning")
266
269
  return tripleCamera
267
270
  }
268
-
269
- // Fall back to wide angle camera
270
- print("[TrustchexCamera] Selected Wide Angle camera for document scanning")
271
- return AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)
271
+
272
+ // Final fallback: any back camera
273
+ return AVCaptureDevice.default(for: .video)
272
274
  }
273
275
 
274
276
 
@@ -294,9 +296,6 @@ class TrustchexCameraView: UIView {
294
296
  do {
295
297
  try camera.lockForConfiguration()
296
298
 
297
- // Configure focus based on camera position
298
- // Front camera: Use continuous autofocus for liveness/face detection at arm's length
299
- // Back camera: Use close-range focus lock for document scanning
300
299
  let isFrontCamera = camera.position == .front
301
300
 
302
301
  if isFrontCamera {
@@ -304,7 +303,6 @@ class TrustchexCameraView: UIView {
304
303
  if camera.isFocusModeSupported(.continuousAutoFocus) {
305
304
  camera.focusMode = .continuousAutoFocus
306
305
 
307
- // Enable smooth autofocus for better face tracking
308
306
  if camera.isSmoothAutoFocusSupported {
309
307
  camera.isSmoothAutoFocusEnabled = true
310
308
  }
@@ -312,27 +310,24 @@ class TrustchexCameraView: UIView {
312
310
  camera.focusMode = .autoFocus
313
311
  }
314
312
  } else {
315
- // Back camera: Close-range focus for document scanning
316
- if #available(iOS 15.0, *) {
317
- if camera.isLockingFocusWithCustomLensPositionSupported {
318
- // Lock focus at close range (0.9) for document scanning
319
- camera.setFocusModeLocked(lensPosition: 0.9, completionHandler: nil)
320
- } else {
321
- // Fallback to continuous autofocus
322
- if camera.isFocusModeSupported(.continuousAutoFocus) {
323
- camera.focusMode = .continuousAutoFocus
324
- }
313
+ // Back camera: Optimized focus for document scanning across all models
314
+ if camera.isFocusModeSupported(.continuousAutoFocus) {
315
+ camera.focusMode = .continuousAutoFocus
316
+
317
+ // Set focus point to center
318
+ if camera.isFocusPointOfInterestSupported {
319
+ camera.focusPointOfInterest = CGPoint(x: 0.5, y: 0.5)
325
320
  }
326
- } else {
327
- // iOS 14 and below: Use continuous autofocus
328
- if camera.isFocusModeSupported(.continuousAutoFocus) {
329
- camera.focusMode = .continuousAutoFocus
330
321
 
331
- if camera.isSmoothAutoFocusSupported {
332
- camera.isSmoothAutoFocusEnabled = true
333
- }
334
- } else if camera.isFocusModeSupported(.autoFocus) {
335
- camera.focusMode = .autoFocus
322
+ // Disable smooth autofocus for faster, more responsive focus on documents
323
+ if camera.isSmoothAutoFocusSupported {
324
+ camera.isSmoothAutoFocusEnabled = false
325
+ }
326
+ } else if camera.isFocusModeSupported(.autoFocus) {
327
+ camera.focusMode = .autoFocus
328
+
329
+ if camera.isFocusPointOfInterestSupported {
330
+ camera.focusPointOfInterest = CGPoint(x: 0.5, y: 0.5)
336
331
  }
337
332
  }
338
333
  }
@@ -19,9 +19,9 @@ const {
19
19
  const {
20
20
  OpenCVModule
21
21
  } = NativeModules;
22
- const MIN_BRIGHTNESS_THRESHOLD = 80;
22
+ const MIN_BRIGHTNESS_THRESHOLD = 60;
23
23
  const BLUR_VARIANCE_THRESHOLD = 60;
24
- const REGION_BRIGHTNESS_THRESHOLD = 70;
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 = isBright; // Default to overall brightness
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 = 60;
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
- setIsBrightnessLow(!isOverallBright);
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
@@ -1195,7 +1203,7 @@ const IdentityDocumentCamera = ({
1195
1203
  // widthPercent
1196
1204
  0.6,
1197
1205
  // heightPercent
1198
- 60 // threshold
1206
+ 50 // threshold
1199
1207
  );
1200
1208
  isNotBlurry = !isBlurry;
1201
1209
  setIsFrameBlurry(isBlurry);
@@ -1204,7 +1212,7 @@ const IdentityDocumentCamera = ({
1204
1212
  }
1205
1213
 
1206
1214
  // Only proceed if image quality is acceptable
1207
- const hasAcceptableQuality = isOverallBright && isNotBlurry;
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: 40,
18
- high: 120,
19
- target: 80
17
+ low: 60,
18
+ high: 140,
19
+ target: 100
20
20
  },
21
21
  faceDetection: {
22
- low: 50,
23
- high: 110,
24
- target: 85
22
+ low: 70,
23
+ high: 140,
24
+ target: 105
25
25
  },
26
26
  mrzScanning: {
27
- low: 45,
28
- high: 130,
29
- target: 80
27
+ low: 65,
28
+ high: 150,
29
+ target: 100
30
30
  }
31
31
  },
32
32
  adaptiveStep: true,
33
33
  maxStepSize: 2,
34
- // Reduced from 3 for smoother transitions
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: 2.0,
39
+ clipLimit: 1.5,
41
40
  tileGridSize: [8, 8]
42
41
  },
43
42
  applyWhen: {
@@ -2,4 +2,4 @@
2
2
 
3
3
  // This file is auto-generated. Do not edit manually.
4
4
  // Version is synced from package.json during build.
5
- export const SDK_VERSION = '1.357.1';
5
+ export const SDK_VERSION = '1.361.0';
@@ -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,4CAwSjB,CAAC;AA6BF,eAAe,UAAU,CAAC"}
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":["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AAM,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,4CAm0G7B,CAAC;AA0LF,eAAe,sBAAsB,CAAC"}
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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
  readonly general: {
14
- readonly low: 40;
15
- readonly high: 120;
16
- readonly target: 80;
14
+ readonly low: 60;
15
+ readonly high: 140;
16
+ readonly target: 100;
17
17
  };
18
18
  readonly faceDetection: {
19
- readonly low: 50;
20
- readonly high: 110;
21
- readonly target: 85;
19
+ readonly low: 70;
20
+ readonly high: 140;
21
+ readonly target: 105;
22
22
  };
23
23
  readonly mrzScanning: {
24
- readonly low: 45;
25
- readonly high: 130;
26
- readonly target: 80;
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: 2;
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.357.1";
1
+ export declare const SDK_VERSION = "1.361.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustchex/react-native-sdk",
3
- "version": "1.357.1",
3
+ "version": "1.361.0",
4
4
  "description": "Trustchex mobile app react native SDK for android or ios devices",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -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 = 80;
29
+ const MIN_BRIGHTNESS_THRESHOLD = 60;
30
30
  const BLUR_VARIANCE_THRESHOLD = 60;
31
- const REGION_BRIGHTNESS_THRESHOLD = 70;
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 = isBright; // Default to overall brightness
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 = 60;
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
- setIsBrightnessLow(!isOverallBright);
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
@@ -1912,7 +1927,7 @@ const IdentityDocumentCamera = ({
1912
1927
  0.5, // centerYPercent
1913
1928
  0.6, // widthPercent
1914
1929
  0.6, // heightPercent
1915
- 60 // threshold
1930
+ 50 // threshold
1916
1931
  );
1917
1932
  isNotBlurry = !isBlurry;
1918
1933
  setIsFrameBlurry(isBlurry);
@@ -1921,7 +1936,7 @@ const IdentityDocumentCamera = ({
1921
1936
  }
1922
1937
 
1923
1938
  // Only proceed if image quality is acceptable
1924
- const hasAcceptableQuality = isOverallBright && isNotBlurry;
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: 40, high: 120, target: 80 },
16
- faceDetection: { low: 50, high: 110, target: 85 },
17
- mrzScanning: { low: 45, high: 130, target: 80 },
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, // Reduced from 3 for smoother transitions
21
- hysteresis: 5, // Dead zone to prevent oscillation
20
+ maxStepSize: 2,
21
+ hysteresis: 5,
22
22
  },
23
23
 
24
24
  contrast: {
25
25
  enabled: true,
26
26
  clahe: {
27
- clipLimit: 2.0,
27
+ clipLimit: 1.5,
28
28
  tileGridSize: [8, 8] as [number, number],
29
29
  },
30
30
  applyWhen: {
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Version is synced from package.json during build.
3
- export const SDK_VERSION = '1.357.1';
3
+ export const SDK_VERSION = '1.361.0';