Skip to content

Commit f244a0f

Browse files
author
Jenkins
committed
3.2.0
1 parent ce94401 commit f244a0f

File tree

10 files changed

+543
-667
lines changed

10 files changed

+543
-667
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $ ionic cordova prepare
2222
* Run `ionic cordova run ios` inside example folder - this is just one way to run the app. You can also run it directly from within Xcode.
2323

2424
## Documentation
25-
You can find documentation on API [here](https://docs.regulaforensics.com/ionic-face).
25+
You can find documentation on API [here](https://docs.regulaforensics.com/develop/face-sdk/mobile).
2626

2727
## Additional information
2828
If you have any technical questions, feel free to [contact](mailto:support@regulaforensics.com) us or create issues [here](https://github.com/regulaforensics/ionic-native-face-api/issues).

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"cordova-ios": "^6.1.1",
3232
"cordova-plugin-add-swift-support": "^2.0.2",
3333
"cordova-plugin-android-permissions": "^1.1.0",
34-
"@regulaforensics/cordova-plugin-face-api": "^3.1.0",
35-
"@regulaforensics/ionic-native-face-api": "^3.1.0",
34+
"@regulaforensics/cordova-plugin-face-api": "^3.2.0",
35+
"@regulaforensics/ionic-native-face-api": "^3.2.0",
3636
"cordova-plugin-file": "^6.0.2",
3737
"cordova-plugin-telerik-imagepicker": "^2.3.5",
3838
"cordova-plugin-dialogs": "^2.0.2",

example/src/app/home/home.page.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { ImagePicker } from '@ionic-native/image-picker/ngx'
44
import { Dialogs } from '@ionic-native/dialogs/ngx'
55
import { AndroidPermissions } from '@ionic-native/android-permissions/ngx'
66
import { Platform } from '@ionic/angular'
7-
import { Enum, FaceCaptureResponse, LivenessResponse, MatchFacesResponse, MatchFacesRequest, Image, FaceSDK } from '@regulaforensics/ionic-native-face-api/ngx'
7+
import { Enum, FaceCaptureResponse, LivenessResponse, MatchFacesResponse, MatchFacesRequest, MatchFacesImage, FaceSDK, MatchFacesSimilarityThresholdSplit } from '@regulaforensics/ionic-native-face-api/ngx'
88

9-
var image1 = new Image()
10-
var image2 = new Image()
9+
var image1 = new MatchFacesImage()
10+
var image2 = new MatchFacesImage()
1111

1212
@Component({
1313
selector: 'app-home',
@@ -41,7 +41,7 @@ export class HomePage {
4141
FaceSDK.startLiveness().then(result => {
4242
result = LivenessResponse.fromJson(JSON.parse(result))
4343
image1.bitmap = result.bitmap
44-
image1.imageType = Enum.ImageType.IMAGE_TYPE_LIVE
44+
image1.imageType = Enum.ImageType.LIVE
4545
app.img1.nativeElement.src = "data:image/png;base64," + result.bitmap
4646
app.livenessResult.nativeElement.innerHTML = result["liveness"] == 0 ? "passed" : "not passed"
4747
})
@@ -55,24 +55,26 @@ export class HomePage {
5555
request.images = [image1, image2]
5656
FaceSDK.matchFaces(JSON.stringify(request)).then(response => {
5757
response = MatchFacesResponse.fromJson(JSON.parse(response))
58-
var matchedFaces = response.matchedFaces
59-
app.similarityResult.nativeElement.innerHTML = matchedFaces.length > 0 ? ((matchedFaces[0].similarity * 100).toFixed(2) + "%") : "error"
58+
FaceSDK.matchFacesSimilarityThresholdSplit(JSON.stringify(response.results), 0.75).then(str => {
59+
var split = MatchFacesSimilarityThresholdSplit.fromJson(JSON.parse(str))
60+
app.similarityResult.nativeElement.innerHTML = split.matchedFaces.length > 0 ? ((split.matchedFaces[0].similarity * 100).toFixed(2) + "%") : "error"
61+
})
6062
})
6163
}
6264

6365
function clearResults() {
6466
app.img1.nativeElement.src = "assets/img/portrait.png"
6567
app.img2.nativeElement.src = "assets/img/portrait.png"
66-
image1 = new Image()
67-
image2 = new Image()
68+
image1 = new MatchFacesImage()
69+
image2 = new MatchFacesImage()
6870
app.similarityResult.nativeElement.innerHTML = "nil"
6971
app.livenessResult.nativeElement.innerHTML = "nil"
7072
}
7173

7274
function pickImage(first: boolean) {
7375
app.dialogs.confirm("Choose the option", "", ["Use camera", "Use gallery"]).then((button) => {
7476
if (button == 1)
75-
FaceSDK.presentFaceCaptureActivity().then(result => setImage(first, FaceCaptureResponse.fromJson(JSON.parse(result)).image.bitmap, Enum.ImageType.IMAGE_TYPE_LIVE))
77+
FaceSDK.presentFaceCaptureActivity().then(result => setImage(first, FaceCaptureResponse.fromJson(JSON.parse(result)).image.bitmap, Enum.ImageType.LIVE))
7678
else if (button == 2)
7779
if (app.platform.is("android"))
7880
useGalleryAndroid(first)
@@ -104,7 +106,7 @@ export class HomePage {
104106
File.readAsDataURL(
105107
(app.platform.is("ios") ? "file://" : "") + results[0].substring(0, (results[0] as string).lastIndexOf("/")),
106108
results[0].substring((results[0] as string).lastIndexOf("/") + 1)).then(
107-
(file => setImage(first, (file as string).substring(23), Enum.ImageType.IMAGE_TYPE_PRINTED))
109+
(file => setImage(first, (file as string).substring(23), Enum.ImageType.PRINTED))
108110
)
109111
})
110112
}

index.d.ts

Lines changed: 90 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,6 @@ export declare class MatchFacesException {
1414
message?: string;
1515
static fromJson(jsonObject?: any): MatchFacesException;
1616
}
17-
export declare class ComparedFacesPairException {
18-
errorCode?: number;
19-
message?: string;
20-
static fromJson(jsonObject?: any): ComparedFacesPairException;
21-
}
22-
export declare class ComparedFace {
23-
tag?: string;
24-
imageType?: number;
25-
position?: number;
26-
static fromJson(jsonObject?: any): ComparedFace;
27-
}
28-
export declare class ComparedFacesPair {
29-
first?: ComparedFace;
30-
second?: ComparedFace;
31-
similarity?: number;
32-
exception?: ComparedFacesPairException;
33-
static fromJson(jsonObject?: any): ComparedFacesPair;
34-
}
3517
export declare class FaceCaptureResponse {
3618
exception?: FaceCaptureException;
3719
image?: Image;
@@ -40,47 +22,98 @@ export declare class FaceCaptureResponse {
4022
export declare class LivenessResponse {
4123
bitmap?: string;
4224
liveness?: number;
25+
guid?: string;
4326
exception?: LivenessErrorException;
4427
static fromJson(jsonObject?: any): LivenessResponse;
4528
}
4629
export declare class MatchFacesResponse {
4730
exception?: MatchFacesException;
48-
matchedFaces?: ComparedFacesPair[];
49-
unmatchedFaces?: ComparedFacesPair[];
31+
detections?: MatchFacesDetection[];
32+
results?: MatchFacesComparedFacesPair[];
5033
static fromJson(jsonObject?: any): MatchFacesResponse;
5134
}
5235
export declare class Image {
5336
imageType?: number;
54-
tag?: string;
5537
bitmap?: string;
5638
static fromJson(jsonObject?: any): Image;
5739
}
5840
export declare class MatchFacesRequest {
59-
similarityThreshold?: number;
60-
images?: Image[];
41+
images?: MatchFacesImage[];
6142
customMetadata?: any;
43+
thumbnails?: boolean;
6244
static fromJson(jsonObject?: any): MatchFacesRequest;
6345
}
64-
export declare const ComparedFacesPairErrorCodes: {
65-
IMAGE_EMPTY: number;
66-
FACE_NOT_DETECTED: number;
67-
LANDMARKS_NOT_DETECTED: number;
68-
FACE_ALIGNER_FAILED: number;
69-
DESCRIPTOR_EXTRACTOR_ERROR: number;
70-
API_CALL_FAILED: number;
46+
export declare class MatchFacesImage {
47+
imageType?: number;
48+
detectAll?: boolean;
49+
bitmap?: string;
50+
identifier?: string;
51+
static fromJson(jsonObject?: any): MatchFacesImage;
52+
}
53+
export declare class MatchFacesComparedFacesPair {
54+
first?: MatchFacesComparedFace;
55+
second?: MatchFacesComparedFace;
56+
similarity?: number;
57+
score?: number;
58+
exception?: MatchFacesException;
59+
static fromJson(jsonObject?: any): MatchFacesComparedFacesPair;
60+
}
61+
export declare class MatchFacesComparedFace {
62+
face?: MatchFacesDetectionFace;
63+
image?: MatchFacesImage;
64+
faceIndex?: number;
65+
imageIndex?: number;
66+
static fromJson(jsonObject?: any): MatchFacesComparedFace;
67+
}
68+
export declare class MatchFacesDetectionFace {
69+
faceIndex?: number;
70+
landmarks?: Point[];
71+
faceRect?: Rect;
72+
rotationAngle?: number;
73+
thumbnail?: string;
74+
static fromJson(jsonObject?: any): MatchFacesDetectionFace;
75+
}
76+
export declare class MatchFacesDetection {
77+
image?: MatchFacesImage;
78+
imageIndex?: number;
79+
faces?: MatchFacesDetectionFace[];
80+
exception?: MatchFacesException;
81+
static fromJson(jsonObject?: any): MatchFacesDetection;
82+
}
83+
export declare class Point {
84+
x?: number;
85+
y?: number;
86+
static fromJson(jsonObject?: any): Point;
87+
}
88+
export declare class Rect {
89+
bottom?: number;
90+
top?: number;
91+
left?: number;
92+
right?: number;
93+
static fromJson(jsonObject?: any): Rect;
94+
}
95+
export declare class MatchFacesSimilarityThresholdSplit {
96+
matchedFaces?: MatchFacesComparedFacesPair[];
97+
unmatchedFaces?: MatchFacesComparedFacesPair[];
98+
static fromJson(jsonObject?: any): MatchFacesSimilarityThresholdSplit;
99+
}
100+
export declare const CameraPosition: {
101+
Back: number;
102+
Front: number;
71103
};
72-
export declare const FaceCaptureResultCodes: {
104+
export declare const FaceCaptureErrorCode: {
73105
CANCEL: number;
74106
CAMERA_NOT_AVAILABLE: number;
75107
CAMERA_NO_PERMISSION: number;
76108
IN_PROGRESS_ALREADY: number;
77109
CONTEXT_IS_NULL: number;
78110
};
79111
export declare const ImageType: {
80-
IMAGE_TYPE_PRINTED: number;
81-
IMAGE_TYPE_RFID: number;
82-
IMAGE_TYPE_LIVE: number;
83-
IMAGE_TYPE_LIVE_WITH_DOC: number;
112+
PRINTED: number;
113+
RFID: number;
114+
LIVE: number;
115+
DOCUMENT_WITH_LIVE: number;
116+
EXTERNAL: number;
84117
};
85118
export declare const LivenessErrorCode: {
86119
CONTEXT_IS_NULL: number;
@@ -91,7 +124,6 @@ export declare const LivenessErrorCode: {
91124
PROCESSING_TIMEOUT: number;
92125
API_CALL_FAILED: number;
93126
PROCESSING_FAILED: number;
94-
PROCESSING_ATTEMPTS_ENDED: number;
95127
};
96128
export declare const LivenessStatus: {
97129
PASSED: number;
@@ -104,37 +136,28 @@ export declare const MatchFacesErrorCodes: {
104136
FACE_ALIGNER_FAILED: number;
105137
DESCRIPTOR_EXTRACTOR_ERROR: number;
106138
NO_LICENSE: number;
107-
NOT_INITIALIZED: number;
108-
COMMAND_IS_NOT_SUPPORTED: number;
109-
COMMAND_PARAMS_READ_ERROR: number;
139+
IMAGES_COUNT_LIMIT_EXCEEDED: number;
110140
API_CALL_FAILED: number;
111141
PROCESSING_FAILED: number;
112142
};
113-
export declare const RFSCameraPosition: {
114-
RFSCameraPositionBack: number;
115-
RFSCameraPositionFront: number;
116-
};
117143
export declare const Enum: {
118-
ComparedFacesPairErrorCodes: {
119-
IMAGE_EMPTY: number;
120-
FACE_NOT_DETECTED: number;
121-
LANDMARKS_NOT_DETECTED: number;
122-
FACE_ALIGNER_FAILED: number;
123-
DESCRIPTOR_EXTRACTOR_ERROR: number;
124-
API_CALL_FAILED: number;
144+
CameraPosition: {
145+
Back: number;
146+
Front: number;
125147
};
126-
FaceCaptureResultCodes: {
148+
FaceCaptureErrorCode: {
127149
CANCEL: number;
128150
CAMERA_NOT_AVAILABLE: number;
129151
CAMERA_NO_PERMISSION: number;
130152
IN_PROGRESS_ALREADY: number;
131153
CONTEXT_IS_NULL: number;
132154
};
133155
ImageType: {
134-
IMAGE_TYPE_PRINTED: number;
135-
IMAGE_TYPE_RFID: number;
136-
IMAGE_TYPE_LIVE: number;
137-
IMAGE_TYPE_LIVE_WITH_DOC: number;
156+
PRINTED: number;
157+
RFID: number;
158+
LIVE: number;
159+
DOCUMENT_WITH_LIVE: number;
160+
EXTERNAL: number;
138161
};
139162
LivenessErrorCode: {
140163
CONTEXT_IS_NULL: number;
@@ -145,7 +168,6 @@ export declare const Enum: {
145168
PROCESSING_TIMEOUT: number;
146169
API_CALL_FAILED: number;
147170
PROCESSING_FAILED: number;
148-
PROCESSING_ATTEMPTS_ENDED: number;
149171
};
150172
LivenessStatus: {
151173
PASSED: number;
@@ -158,16 +180,10 @@ export declare const Enum: {
158180
FACE_ALIGNER_FAILED: number;
159181
DESCRIPTOR_EXTRACTOR_ERROR: number;
160182
NO_LICENSE: number;
161-
NOT_INITIALIZED: number;
162-
COMMAND_IS_NOT_SUPPORTED: number;
163-
COMMAND_PARAMS_READ_ERROR: number;
183+
IMAGES_COUNT_LIMIT_EXCEEDED: number;
164184
API_CALL_FAILED: number;
165185
PROCESSING_FAILED: number;
166186
};
167-
RFSCameraPosition: {
168-
RFSCameraPositionBack: number;
169-
RFSCameraPositionFront: number;
170-
};
171187
};
172188
/**
173189
* @name FaceSDK
@@ -227,15 +243,20 @@ export declare class FaceSDKOriginal extends IonicNativePlugin {
227243
* description
228244
*
229245
* @param {object} config int cameraId - set camera on Android
230-
* RFSCameraPosition cameraPositionIOS - set camera on iOS
246+
* CameraPosition cameraPositionIOS - set camera on iOS
247+
* boolean cameraSwitchEnabled
248+
* boolean showHelpTextAnimation
231249
* @return {Promise<any>} Returns a promise
232250
*/
233251
presentFaceCaptureActivityWithConfig(config: any): Promise<any>;
234252
/**
235253
* description
236254
*
237255
* @param {object} config int cameraId - set camera on Android
238-
* RFSCameraPosition cameraPositionIOS - set camera on iOS
256+
* CameraPosition cameraPositionIOS - set camera on iOS
257+
* boolean cameraSwitchEnabled
258+
* boolean showHelpTextAnimation
259+
* boolean locationTrackingEnabled
239260
* @return {Promise<any>} Returns a promise
240261
*/
241262
startLivenessWithConfig(config: any): Promise<any>;
@@ -263,11 +284,12 @@ export declare class FaceSDKOriginal extends IonicNativePlugin {
263284
/**
264285
* description
265286
*
266-
* @param {MatchFacesRequest} request description
267-
* @param {object} config description
287+
* @param {string} faces facesArray: MatchFacesComparedFacesPair[]
288+
* faces = JSON.stringify(facesArray)
289+
* @param {number} similarity description
268290
* @return {Promise<any>} Returns a promise
269291
*/
270-
matchFacesWithConfig(request: any, config: any): Promise<any>;
292+
matchFacesSimilarityThresholdSplit(faces: any, similarity: any): Promise<any>;
271293
}
272294

273295
export declare const FaceSDK: FaceSDKOriginal;

0 commit comments

Comments
 (0)