diff --git a/demo-snippets/platforms/android/cpp/DocumentDetector.cpp b/demo-snippets/platforms/android/cpp/DocumentDetector.cpp index cff0c27..4995364 100644 --- a/demo-snippets/platforms/android/cpp/DocumentDetector.cpp +++ b/demo-snippets/platforms/android/cpp/DocumentDetector.cpp @@ -78,7 +78,7 @@ vector> DocumentDetector::scanPoint(Mat &edged) { double height; Mat image = resizeImage(); // convert photo to LUV colorspace to avoid glares caused by lights - cvtColor(image, image, COLOR_BGR2Luv); + cvtColor(image, image, COLOR_BGR2GRAY); if (imageRotation != 0) { switch (imageRotation) { case 90: diff --git a/demo-snippets/platforms/ios/src/DocumentDetector.cpp b/demo-snippets/platforms/ios/src/DocumentDetector.cpp index cff0c27..4995364 100644 --- a/demo-snippets/platforms/ios/src/DocumentDetector.cpp +++ b/demo-snippets/platforms/ios/src/DocumentDetector.cpp @@ -78,7 +78,7 @@ vector> DocumentDetector::scanPoint(Mat &edged) { double height; Mat image = resizeImage(); // convert photo to LUV colorspace to avoid glares caused by lights - cvtColor(image, image, COLOR_BGR2Luv); + cvtColor(image, image, COLOR_BGR2GRAY); if (imageRotation != 0) { switch (imageRotation) { case 90: diff --git a/packages/ui-cameraview/platforms/android/AndroidManifest.xml b/packages/ui-cameraview/platforms/android/AndroidManifest.xml index 4413277..c9b6129 100644 --- a/packages/ui-cameraview/platforms/android/AndroidManifest.xml +++ b/packages/ui-cameraview/platforms/android/AndroidManifest.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/packages/ui-cameraview/platforms/android/native-api-usage.json b/packages/ui-cameraview/platforms/android/native-api-usage.json index 343a099..b8d54f9 100644 --- a/packages/ui-cameraview/platforms/android/native-api-usage.json +++ b/packages/ui-cameraview/platforms/android/native-api-usage.json @@ -1,8 +1,8 @@ { "uses": [ - "com.akylas.cameraview.ImageAnalysisCallback", - "com.akylas.cameraview.CameraEventListener", - "com.akylas.cameraview.CameraView", - "com.akylas.cameraview.CameraFlashMode" + "com.akylas.cameraview:ImageAnalysisCallback", + "com.akylas.cameraview:CameraEventListener", + "com.akylas.cameraview:CameraView", + "com.akylas.cameraview:CameraFlashMode" ] } \ No newline at end of file diff --git a/src/ui-cameraview/index.android.ts b/src/ui-cameraview/index.android.ts index ff1605e..c2248ec 100644 --- a/src/ui-cameraview/index.android.ts +++ b/src/ui-cameraview/index.android.ts @@ -77,7 +77,7 @@ export class CameraView extends CameraViewBase { try { this.notify({ eventName: 'frame', object: this, image, info, processor }); } catch (err) { - console.log('process error', err, err.stack); + console.error('process error', err, err.stack); } } }); @@ -153,12 +153,10 @@ export class CameraView extends CameraViewBase { return new Promise((resolve, reject) => { const myListener = { onCameraPhoto: (file) => { - console.log('onCameraPhoto', file); removeListener(); resolve(file); }, onCameraPhotoImage: (image, info, processor) => { - console.log('onCameraPhotoImage', image, info, processor); removeListener(); resolve({ image, info, processor }); }, diff --git a/src/ui-cameraview/index.d.ts b/src/ui-cameraview/index.d.ts index 24887b5..b0f7dbe 100644 --- a/src/ui-cameraview/index.d.ts +++ b/src/ui-cameraview/index.d.ts @@ -1,3 +1,23 @@ import { GridLayout } from '@nativescript/core'; -export class CameraView extends GridLayout {} +export class CameraView extends GridLayout { + autoFocus: boolean; + processor; + enablePinchZoom: boolean; + saveToGallery: boolean; + flashMode: string; + stopPreview(); + startPreview(); + toggleCamera(); + takePicture( + options: { + savePhotoToDisk?: boolean; + captureMode?: number; + targetRotation?: number; + flashMode?: number; + pictureSize?: { width: number; height: number }; + } = {} + ): Promise; + startAutoFocus(); + focusAtPoint(x, y); +} diff --git a/src/ui-cameraview/index.ios.ts b/src/ui-cameraview/index.ios.ts index b7049e9..dcc0d80 100644 --- a/src/ui-cameraview/index.ios.ts +++ b/src/ui-cameraview/index.ios.ts @@ -108,6 +108,20 @@ export class CameraView extends CameraViewBase { this.previewStarted = false; this.nativeViewProtected?.stopPreview(); } + focusAtPoint(x, y) { + this.nativeViewProtected?.nextLevel?.focusAtAdjustedPointOfInterest(CGPointMake(x, y)); + } + async takePicture( + options: { + savePhotoToDisk?: boolean; + captureMode?: number; + targetRotation?: number; + flashMode?: number; + pictureSize?: { width: number; height: number }; + } = {} + ) { + throw new Error('not implemented'); + } [flashModeProperty.setNative](value: string | number) { if (typeof value === 'string') {