-
Notifications
You must be signed in to change notification settings - Fork 5
/
MetadataCallbacks.ts
99 lines (87 loc) · 2.74 KB
/
MetadataCallbacks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* Copyright (c) Microblink Ltd. All rights reserved.
*/
import { Point, Quadrilateral } from "./Geometry";
/**
* Interface representing possible events that can occur during image processing.
* All functions in this interface are optional and will be called only if they are
* implemented.
*/
export interface MetadataCallbacks
{
/**
* Called when recognition process wants to display some debug text information.
* @param debugTest Debug text information to be displayed.
*/
onDebugText?( debugTest: string ): void
/**
* Called when all recognizers in RecognizerRunner have failed to detect anything on the image.
*/
onDetectionFailed?(): void
/**
* Called when recognition process wants to display some quadrilateral.
* @param quad Quadrilateral to be displayed.
*/
onQuadDetection?( quad: DisplayableQuad ): void
/**
* Called when recognition process wants to display some points.
* @param pointSet Points to be displayed.
*/
onPointsDetection?( pointSet: DisplayablePoints ): void
/**
* Called when first side recognition with the multi-side recognizer completes.
*/
onFirstSideResult?(): void
/**
* Called when glare detection has completed with result whether glare has been found or not.
* @param hasGlare indicates whether glare has been found on the input image or not
*/
onGlare?( hasGlare: boolean ): void;
}
/**
* Detection status of the specific detected object.
*/
export enum DetectionStatus
{
/** Detection failed, form not detected */
Fail = 0,
/** Object was successfully detected */
Success,
/** Object detected, but the camera is too far above it */
CameraTooHigh,
/** Fallback detection of an object was successful */
FallbackSuccess,
/** Object is detected, but parts of it are not in image */
Partial,
/** Object detected, but camera is at too big angle */
CameraAtAngle,
/** Object detected, but the camera is too near to it */
CameraTooNear,
/** Document detected, but document is too close to the edge of the frame */
DocumentTooCloseToEdge
}
/**
* Interface representing any displayable object.
*/
export interface Displayable
{
/** Detection status of the displayable object. */
detectionStatus: DetectionStatus
/**
* 3x3 transformation matrix from the image's coordinate system to view's coordinate system.
*/
transformMatrix: Float32Array
}
/**
* Interface representing quadrilateral in image.
*/
export interface DisplayableQuad extends Displayable, Quadrilateral
{}
/**
* Interface representing list of points in image.
*/
export interface DisplayablePoints extends Displayable
{
/** Array of points */
points: Point[]
}