Skip to content

Commit

Permalink
fix: multiple fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Oct 10, 2023
1 parent e5dab8e commit 22dc0cc
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 11 deletions.
2 changes: 1 addition & 1 deletion demo-snippets/platforms/android/cpp/DocumentDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ vector<vector<cv::Point>> 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:
Expand Down
2 changes: 1 addition & 1 deletion demo-snippets/platforms/ios/src/DocumentDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ vector<vector<cv::Point>> 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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nativescript.cameraview">

<uses-permission android:name="android.permission.CAMERA" />
</manifest>
Original file line number Diff line number Diff line change
@@ -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"
]
}
4 changes: 1 addition & 3 deletions src/ui-cameraview/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
Expand Down Expand Up @@ -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 });
},
Expand Down
22 changes: 21 additions & 1 deletion src/ui-cameraview/index.d.ts
Original file line number Diff line number Diff line change
@@ -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<any>;
startAutoFocus();
focusAtPoint(x, y);
}
14 changes: 14 additions & 0 deletions src/ui-cameraview/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 22dc0cc

Please sign in to comment.