@techstark/opencv-js 4.11.0-release.1 → 5.0.0-release.1
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.
- package/README.md +22 -17
- package/dist/opencv.js +0 -0
- package/dist/opencv.js.patch +18 -10
- package/dist/src/types/opencv/BackgroundSubtractor.d.ts +33 -0
- package/dist/src/types/opencv/BackgroundSubtractor.js +3 -0
- package/dist/src/types/opencv/BackgroundSubtractor.js.map +1 -0
- package/dist/src/types/opencv/BackgroundSubtractorMOG2.d.ts +21 -0
- package/dist/src/types/opencv/BackgroundSubtractorMOG2.js +3 -0
- package/dist/src/types/opencv/BackgroundSubtractorMOG2.js.map +1 -0
- package/dist/src/types/opencv/Feature2D.d.ts +1 -1
- package/dist/src/types/opencv/Mat.d.ts +6 -1
- package/dist/src/types/opencv/ORB.d.ts +1 -1
- package/dist/src/types/opencv/QRCodeDetector.d.ts +76 -0
- package/dist/src/types/opencv/QRCodeDetector.js +3 -0
- package/dist/src/types/opencv/QRCodeDetector.js.map +1 -0
- package/dist/src/types/opencv/QRCodeDetectorAruco.d.ts +101 -0
- package/dist/src/types/opencv/QRCodeDetectorAruco.js +3 -0
- package/dist/src/types/opencv/QRCodeDetectorAruco.js.map +1 -0
- package/dist/src/types/opencv/_types.d.ts +3 -0
- package/dist/src/types/opencv/_types.js +3 -0
- package/dist/src/types/opencv/_types.js.map +1 -1
- package/dist/src/types/opencv/imgproc_colormap.d.ts +43 -0
- package/dist/src/types/opencv/imgproc_colormap.js +3 -0
- package/dist/src/types/opencv/imgproc_colormap.js.map +1 -0
- package/dist/src/types/opencv/imgproc_shape.d.ts +2 -2
- package/dist/src/types/opencv/objdetect.d.ts +2 -0
- package/dist/src/types/opencv/objdetect.js +6 -0
- package/dist/src/types/opencv/objdetect.js.map +1 -1
- package/package.json +9 -8
- package/src/types/opencv/BackgroundSubtractor.ts +36 -0
- package/src/types/opencv/BackgroundSubtractorMOG2.ts +22 -0
- package/src/types/opencv/Feature2D.ts +1 -1
- package/src/types/opencv/FlannBasedMatcher.ts +8 -1
- package/src/types/opencv/Mat.ts +7 -1
- package/src/types/opencv/ORB.ts +1 -1
- package/src/types/opencv/QRCodeDetector.ts +111 -0
- package/src/types/opencv/QRCodeDetectorAruco.ts +139 -0
- package/src/types/opencv/_types.ts +3 -0
- package/src/types/opencv/imgproc_colormap.ts +60 -0
- package/src/types/opencv/imgproc_shape.ts +3 -5
- package/src/types/opencv/objdetect.ts +6 -0
package/README.md
CHANGED
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
# opencv-js
|
|
2
2
|
|
|
3
|
-
OpenCV JavaScript version (NPM package) for node.js or browser. Get started guide [OpenCV.js Tutorials](https://docs.opencv.org/
|
|
3
|
+
OpenCV JavaScript version (NPM package) for node.js or browser. Get started guide [OpenCV.js Tutorials](https://docs.opencv.org/5.0.0/#:~:text=OpenCV%2DPython%20Tutorials-,OpenCV.js%20Tutorials,-Tutorials%20for%20contrib).
|
|
4
4
|
|
|
5
|
-
The file `opencv.js` was downloaded from https://docs.opencv.org/
|
|
5
|
+
The file `opencv.js` was downloaded from https://docs.opencv.org/5.0.0/opencv.js
|
|
6
6
|
|
|
7
7
|
TypeScript is supported (thanks to `mirada`).
|
|
8
8
|
|
|
9
9
|
# Basic Usage
|
|
10
10
|
|
|
11
|
-
## >=4.11
|
|
12
|
-
|
|
13
11
|
```js
|
|
14
|
-
import
|
|
12
|
+
import cvModule from "@techstark/opencv-js";
|
|
13
|
+
|
|
14
|
+
async function getOpenCv() {
|
|
15
|
+
let cv;
|
|
16
|
+
if (cvModule instanceof Promise) {
|
|
17
|
+
cv = await cvModule;
|
|
18
|
+
} else {
|
|
19
|
+
if (cvModule.Mat) {
|
|
20
|
+
cv = cvModule;
|
|
21
|
+
} else {
|
|
22
|
+
await new Promise((resolve) => {
|
|
23
|
+
cvModule.onRuntimeInitialized = () => resolve();
|
|
24
|
+
});
|
|
25
|
+
cv = cvModule;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return { cv };
|
|
29
|
+
}
|
|
15
30
|
|
|
16
31
|
async function main() {
|
|
17
|
-
const cv = await
|
|
32
|
+
const { cv } = await getOpenCv();
|
|
18
33
|
console.log("OpenCV.js is ready!");
|
|
19
34
|
// You can now use OpenCV functions here
|
|
20
35
|
console.log(cv.getBuildInformation());
|
|
21
36
|
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## <=4.10
|
|
25
37
|
|
|
26
|
-
|
|
27
|
-
import cv from "@techstark/opencv-js";
|
|
28
|
-
|
|
29
|
-
cv.onRuntimeInitialized = () => {
|
|
30
|
-
console.log("OpenCV.js is ready!");
|
|
31
|
-
// You can now use OpenCV functions here
|
|
32
|
-
console.log(cv.getBuildInformation());
|
|
33
|
-
};
|
|
38
|
+
main();
|
|
34
39
|
```
|
|
35
40
|
|
|
36
41
|
# Code Examples
|
package/dist/opencv.js
CHANGED
|
Binary file
|
package/dist/opencv.js.patch
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
diff --git a/dist/opencv.js b/dist/opencv.js
|
|
2
|
-
index af4111b..3ba8a69 100644
|
|
3
1
|
--- a/dist/opencv.js
|
|
4
2
|
+++ b/dist/opencv.js
|
|
5
|
-
@@
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
@@ UMD wrapper call @@
|
|
4
|
+
-}(this, function () {
|
|
5
|
+
+}(globalThis, function () {
|
|
6
|
+
|
|
7
|
+
Fixes: In browser ESM (<script type="module">), top-level `this` is
|
|
8
|
+
undefined. The UMD else branch `root.cv = factory()` then throws:
|
|
9
|
+
TypeError: Cannot set properties of undefined (setting 'cv')
|
|
10
|
+
Using `globalThis` is always defined in modern environments.
|
|
11
|
+
|
|
12
|
+
@@ UMD factory tail @@
|
|
13
|
+
- if (typeof Module === 'undefined')
|
|
9
14
|
- Module = {};
|
|
15
|
+
+ if (typeof Module === 'undefined')
|
|
10
16
|
+ var Module = {};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
|
|
18
|
+
Fixes: When opencv.js is bundled by Webpack (which wraps everything in
|
|
19
|
+
"use strict"), the bare `Module = {}` assignment throws:
|
|
20
|
+
ReferenceError: Module is not defined
|
|
21
|
+
Declaring with `var` creates a local variable instead of an implicit
|
|
22
|
+
global assignment, which is safe in strict mode.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Algorithm, double, InputArray, OutputArray } from "./_types";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for background/foreground segmentation algorithms.
|
|
4
|
+
*
|
|
5
|
+
* The class is only used to define the common interface for the whole family of background/foreground
|
|
6
|
+
* segmentation algorithms.
|
|
7
|
+
*
|
|
8
|
+
* Source:
|
|
9
|
+
* [opencv2/video.hpp](https://github.com/opencv/opencv/tree/master/modules/video/include/opencv2/video/background_segm.hpp).
|
|
10
|
+
*/
|
|
11
|
+
export declare class BackgroundSubtractor extends Algorithm {
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Computes a foreground mask.
|
|
15
|
+
*
|
|
16
|
+
* @param image Next video frame.
|
|
17
|
+
* @param fgmask The output foreground mask as an 8-bit binary image.
|
|
18
|
+
* @param learningRate The value between 0 and 1 that indicates how fast the background model is learnt.
|
|
19
|
+
* Negative parameter value makes the algorithm use some automatically chosen learning rate.
|
|
20
|
+
* 0 means that the background model is not updated at all, 1 means that the background model is
|
|
21
|
+
* completely reinitialized from the last frame.
|
|
22
|
+
*/
|
|
23
|
+
apply(image: InputArray, fgmask: OutputArray, learningRate?: double): void;
|
|
24
|
+
/**
|
|
25
|
+
* Computes a background image.
|
|
26
|
+
*
|
|
27
|
+
* @param backgroundImage The output background image.
|
|
28
|
+
*
|
|
29
|
+
* @note Sometimes the background image can be very blurry, as it contain the average background
|
|
30
|
+
* statistics.
|
|
31
|
+
*/
|
|
32
|
+
getBackgroundImage(backgroundImage: OutputArray): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackgroundSubtractor.js","sourceRoot":"","sources":["../../../../src/types/opencv/BackgroundSubtractor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BackgroundSubtractor, bool, double, int } from "./_types";
|
|
2
|
+
/**
|
|
3
|
+
* Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
|
|
4
|
+
*
|
|
5
|
+
* The class implements the Gaussian mixture model background subtraction described in [Zivkovic2004]
|
|
6
|
+
* and [Zivkovic2006].
|
|
7
|
+
*
|
|
8
|
+
* Source:
|
|
9
|
+
* [opencv2/video.hpp](https://github.com/opencv/opencv/tree/master/modules/video/include/opencv2/video/background_segm.hpp).
|
|
10
|
+
*/
|
|
11
|
+
export declare class BackgroundSubtractorMOG2 extends BackgroundSubtractor {
|
|
12
|
+
/**
|
|
13
|
+
* @param history Length of the history.
|
|
14
|
+
* @param varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model
|
|
15
|
+
* to decide whether a pixel is well described by the background model. This parameter does not
|
|
16
|
+
* affect the background update.
|
|
17
|
+
* @param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
|
|
18
|
+
* speed a bit, so if you do not need this feature, set the parameter to false.
|
|
19
|
+
*/
|
|
20
|
+
constructor(history?: int, varThreshold?: double, detectShadows?: bool);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackgroundSubtractorMOG2.js","sourceRoot":"","sources":["../../../../src/types/opencv/BackgroundSubtractorMOG2.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Algorithm, KeyPointVector, Mat, OutputArray } from "./_types";
|
|
2
2
|
/**
|
|
3
|
-
* https://docs.opencv.org/
|
|
3
|
+
* https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html
|
|
4
4
|
*/
|
|
5
5
|
export declare class Feature2D extends Algorithm {
|
|
6
6
|
/**
|
|
@@ -706,6 +706,11 @@ export declare class Mat extends EmscriptenEmbindInstance {
|
|
|
706
706
|
* the array copy is a continuous array occupying [total()]*elemSize() bytes.
|
|
707
707
|
*/
|
|
708
708
|
clone(): Mat;
|
|
709
|
+
/**
|
|
710
|
+
* Creates a deep copy of the Mat with independent data buffer.
|
|
711
|
+
* This method ensures the copied Mat has its own data that is independent of the original.
|
|
712
|
+
*/
|
|
713
|
+
mat_clone(): Mat;
|
|
709
714
|
/**
|
|
710
715
|
* The method makes a new header for the specified matrix column and returns it. This is an O(1)
|
|
711
716
|
* operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
|
|
@@ -1438,7 +1443,7 @@ export declare class Mat extends EmscriptenEmbindInstance {
|
|
|
1438
1443
|
*/
|
|
1439
1444
|
type(): int;
|
|
1440
1445
|
updateContinuityFlag(): void;
|
|
1441
|
-
ucharPtr(i: any, j
|
|
1446
|
+
ucharPtr(i: any, j?: any): any;
|
|
1442
1447
|
charPtr(i: any, j: any): any;
|
|
1443
1448
|
shortPtr(i: any, j: any): any;
|
|
1444
1449
|
ushortPtr(i: any, j: any): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Feature2D, float, int } from "./_types";
|
|
2
2
|
/**
|
|
3
|
-
* https://docs.opencv.org/
|
|
3
|
+
* https://docs.opencv.org/master/db/d95/classcv_1_1ORB.html
|
|
4
4
|
*/
|
|
5
5
|
export declare class ORB extends Feature2D {
|
|
6
6
|
constructor(nfeatures?: int, scaleFactor?: float, nlevels?: int, edgeThreshold?: int, firstLevel?: int, WTA_K?: int, scoreType?: ORBScoreType, patchSize?: int, fastThreshold?: int);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { bool, InputArray, OutputArray, OutputArrayOfArrays } from "./_types";
|
|
2
|
+
/**
|
|
3
|
+
* QR Code detection and decoding class.
|
|
4
|
+
*
|
|
5
|
+
* This class implements QR code detection and decoding functionality.
|
|
6
|
+
* It can detect QR codes in an image and decode their content.
|
|
7
|
+
*
|
|
8
|
+
* Source:
|
|
9
|
+
* [opencv2/objdetect.hpp](https://github.com/opencv/opencv/tree/master/modules/objdetect/include/opencv2/objdetect.hpp).
|
|
10
|
+
*/
|
|
11
|
+
export declare class QRCodeDetector {
|
|
12
|
+
/**
|
|
13
|
+
* QRCodeDetector constructor
|
|
14
|
+
*/
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Detects QR code in image and returns the quadrangle containing the code.
|
|
18
|
+
*
|
|
19
|
+
* @param img grayscale or color (BGR) image containing (or not) QR code.
|
|
20
|
+
* @param points Output vector of vertices of the minimum-area quadrangle containing the code.
|
|
21
|
+
*/
|
|
22
|
+
detect(img: InputArray, points: OutputArray): bool;
|
|
23
|
+
/**
|
|
24
|
+
* Decodes QR code in image once it's found by the detect() method.
|
|
25
|
+
*
|
|
26
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
27
|
+
* @param points Quadrangle vertices found by detect() method (or some other algorithm).
|
|
28
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
29
|
+
*/
|
|
30
|
+
decode(img: InputArray, points: InputArray, straight_qrcode?: OutputArray): String;
|
|
31
|
+
/**
|
|
32
|
+
* Both detects and decodes QR code
|
|
33
|
+
*
|
|
34
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
35
|
+
* @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found.
|
|
36
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
37
|
+
*/
|
|
38
|
+
detectAndDecode(img: InputArray, points?: OutputArray, straight_qrcode?: OutputArray): String;
|
|
39
|
+
/**
|
|
40
|
+
* Detects QR codes in image and returns the vector of the quadrangles containing the codes.
|
|
41
|
+
*
|
|
42
|
+
* @param img grayscale or color (BGR) image containing (or not) QR codes.
|
|
43
|
+
* @param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes.
|
|
44
|
+
*/
|
|
45
|
+
detectMulti(img: InputArray, points: OutputArrayOfArrays): bool;
|
|
46
|
+
/**
|
|
47
|
+
* Decodes QR codes in image once it's found by the detectMulti() method.
|
|
48
|
+
*
|
|
49
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
50
|
+
* @param points vector of Quadrangle vertices found by detectMulti() method (or some other algorithm).
|
|
51
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
52
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
53
|
+
*/
|
|
54
|
+
decodeMulti(img: InputArray, points: InputArray, decoded_info: any, straight_qrcode?: OutputArrayOfArrays): bool;
|
|
55
|
+
/**
|
|
56
|
+
* Both detects and decodes QR codes
|
|
57
|
+
*
|
|
58
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
59
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
60
|
+
* @param points optional output vector of vertices of the found QR code quadrangles. Will be empty if not found.
|
|
61
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
62
|
+
*/
|
|
63
|
+
detectAndDecodeMulti(img: InputArray, decoded_info: any, points?: OutputArrayOfArrays, straight_qrcode?: OutputArrayOfArrays): bool;
|
|
64
|
+
/**
|
|
65
|
+
* Aruco-based QR code detector
|
|
66
|
+
*/
|
|
67
|
+
setUseAruco(use_aruco: bool): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get if Aruco-based QR code detector is used
|
|
70
|
+
*/
|
|
71
|
+
getUseAruco(): bool;
|
|
72
|
+
/**
|
|
73
|
+
* Releases the object
|
|
74
|
+
*/
|
|
75
|
+
delete(): void;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCodeDetector.js","sourceRoot":"","sources":["../../../../src/types/opencv/QRCodeDetector.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { bool, float, InputArray, OutputArray, OutputArrayOfArrays } from "./_types";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for QRCodeDetectorAruco
|
|
4
|
+
*/
|
|
5
|
+
export declare class QRCodeDetectorAruco_Params {
|
|
6
|
+
minModuleSizeInPyramid: float;
|
|
7
|
+
maxRotation: float;
|
|
8
|
+
maxModuleSizeMismatch: float;
|
|
9
|
+
maxTimingPatternMismatch: float;
|
|
10
|
+
maxPenalties: float;
|
|
11
|
+
maxColorsMismatch: float;
|
|
12
|
+
scaleTimingPatternScore: float;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Releases the object
|
|
16
|
+
*/
|
|
17
|
+
delete(): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* QR Code detection and decoding class using Aruco-based detection.
|
|
21
|
+
*
|
|
22
|
+
* This class implements QR code detection and decoding functionality using
|
|
23
|
+
* Aruco marker detection techniques for improved robustness.
|
|
24
|
+
*
|
|
25
|
+
* Source:
|
|
26
|
+
* [opencv2/objdetect.hpp](https://github.com/opencv/opencv/tree/master/modules/objdetect/include/opencv2/objdetect.hpp).
|
|
27
|
+
*/
|
|
28
|
+
export declare class QRCodeDetectorAruco {
|
|
29
|
+
/**
|
|
30
|
+
* QRCodeDetectorAruco constructor
|
|
31
|
+
*/
|
|
32
|
+
constructor();
|
|
33
|
+
/**
|
|
34
|
+
* QRCodeDetectorAruco constructor with parameters
|
|
35
|
+
*
|
|
36
|
+
* @param params QRCodeDetectorAruco parameters
|
|
37
|
+
*/
|
|
38
|
+
constructor(params: QRCodeDetectorAruco_Params);
|
|
39
|
+
/**
|
|
40
|
+
* Detects QR code in image and returns the quadrangle containing the code.
|
|
41
|
+
*
|
|
42
|
+
* @param img grayscale or color (BGR) image containing (or not) QR code.
|
|
43
|
+
* @param points Output vector of vertices of the minimum-area quadrangle containing the code.
|
|
44
|
+
*/
|
|
45
|
+
detect(img: InputArray, points: OutputArray): bool;
|
|
46
|
+
/**
|
|
47
|
+
* Decodes QR code in image once it's found by the detect() method.
|
|
48
|
+
*
|
|
49
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
50
|
+
* @param points Quadrangle vertices found by detect() method (or some other algorithm).
|
|
51
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
52
|
+
*/
|
|
53
|
+
decode(img: InputArray, points: InputArray, straight_qrcode?: OutputArray): String;
|
|
54
|
+
/**
|
|
55
|
+
* Both detects and decodes QR code
|
|
56
|
+
*
|
|
57
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
58
|
+
* @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found.
|
|
59
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
60
|
+
*/
|
|
61
|
+
detectAndDecode(img: InputArray, points?: OutputArray, straight_qrcode?: OutputArray): String;
|
|
62
|
+
/**
|
|
63
|
+
* Detects QR codes in image and returns the vector of the quadrangles containing the codes.
|
|
64
|
+
*
|
|
65
|
+
* @param img grayscale or color (BGR) image containing (or not) QR codes.
|
|
66
|
+
* @param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes.
|
|
67
|
+
*/
|
|
68
|
+
detectMulti(img: InputArray, points: OutputArrayOfArrays): bool;
|
|
69
|
+
/**
|
|
70
|
+
* Decodes QR codes in image once it's found by the detectMulti() method.
|
|
71
|
+
*
|
|
72
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
73
|
+
* @param points vector of Quadrangle vertices found by detectMulti() method (or some other algorithm).
|
|
74
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
75
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
76
|
+
*/
|
|
77
|
+
decodeMulti(img: InputArray, points: InputArray, decoded_info: any, straight_qrcode?: OutputArrayOfArrays): bool;
|
|
78
|
+
/**
|
|
79
|
+
* Both detects and decodes QR codes
|
|
80
|
+
*
|
|
81
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
82
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
83
|
+
* @param points optional output vector of vertices of the found QR code quadrangles. Will be empty if not found.
|
|
84
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
85
|
+
*/
|
|
86
|
+
detectAndDecodeMulti(img: InputArray, decoded_info: any, points?: OutputArrayOfArrays, straight_qrcode?: OutputArrayOfArrays): bool;
|
|
87
|
+
/**
|
|
88
|
+
* Get detector parameters
|
|
89
|
+
*/
|
|
90
|
+
getDetectorParameters(): QRCodeDetectorAruco_Params;
|
|
91
|
+
/**
|
|
92
|
+
* Set detector parameters
|
|
93
|
+
*
|
|
94
|
+
* @param params QRCodeDetectorAruco parameters
|
|
95
|
+
*/
|
|
96
|
+
setDetectorParameters(params: QRCodeDetectorAruco_Params): void;
|
|
97
|
+
/**
|
|
98
|
+
* Releases the object
|
|
99
|
+
*/
|
|
100
|
+
delete(): void;
|
|
101
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCodeDetectorAruco.js","sourceRoot":"","sources":["../../../../src/types/opencv/QRCodeDetectorAruco.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./Affine3";
|
|
2
2
|
export * from "./Algorithm";
|
|
3
3
|
export * from "./AutoBuffer";
|
|
4
|
+
export * from "./BackgroundSubtractor";
|
|
5
|
+
export * from "./BackgroundSubtractorMOG2";
|
|
4
6
|
export * from "./BFMatcher";
|
|
5
7
|
export * from "./BOWTrainer";
|
|
6
8
|
export * from "./calib3d";
|
|
@@ -19,6 +21,7 @@ export * from "./fisheye";
|
|
|
19
21
|
export * from "./FlannBasedMatcher";
|
|
20
22
|
export * from "./HOGDescriptor";
|
|
21
23
|
export * from "./imgproc_color_conversions";
|
|
24
|
+
export * from "./imgproc_colormap";
|
|
22
25
|
export * from "./imgproc_draw";
|
|
23
26
|
export * from "./imgproc_feature";
|
|
24
27
|
export * from "./imgproc_filter";
|
|
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Affine3"), exports);
|
|
18
18
|
__exportStar(require("./Algorithm"), exports);
|
|
19
19
|
__exportStar(require("./AutoBuffer"), exports);
|
|
20
|
+
__exportStar(require("./BackgroundSubtractor"), exports);
|
|
21
|
+
__exportStar(require("./BackgroundSubtractorMOG2"), exports);
|
|
20
22
|
__exportStar(require("./BFMatcher"), exports);
|
|
21
23
|
__exportStar(require("./BOWTrainer"), exports);
|
|
22
24
|
__exportStar(require("./calib3d"), exports);
|
|
@@ -35,6 +37,7 @@ __exportStar(require("./fisheye"), exports);
|
|
|
35
37
|
__exportStar(require("./FlannBasedMatcher"), exports);
|
|
36
38
|
__exportStar(require("./HOGDescriptor"), exports);
|
|
37
39
|
__exportStar(require("./imgproc_color_conversions"), exports);
|
|
40
|
+
__exportStar(require("./imgproc_colormap"), exports);
|
|
38
41
|
__exportStar(require("./imgproc_draw"), exports);
|
|
39
42
|
__exportStar(require("./imgproc_feature"), exports);
|
|
40
43
|
__exportStar(require("./imgproc_filter"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../../src/types/opencv/_types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAC5B,+CAA6B;AAC7B,4CAA0B;AAC1B,sDAAoC;AACpC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,+CAA6B;AAC7B,sDAAoC;AACpC,wCAAsB;AACtB,kDAAgC;AAChC,8CAA4B;AAC5B,8CAA4B;AAC5B,oDAAkC;AAClC,4CAA0B;AAC1B,sDAAoC;AACpC,kDAAgC;AAChC,8DAA4C;AAC5C,iDAA+B;AAC/B,oDAAkC;AAClC,mDAAiC;AACjC,iDAA+B;AAC/B,iDAA+B;AAC/B,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AACpC,2CAAyB;AACzB,6CAA2B;AAC3B,wCAAsB;AACtB,4CAA0B;AAC1B,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,8CAA4B;AAC5B,wCAAsB;AACtB,wCAAsB;AACtB,kDAAgC;AAChC,gDAA8B;AAC9B,+CAA6B;AAC7B,8CAA4B;AAC5B,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../../src/types/opencv/_types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B;AAC7B,yDAAuC;AACvC,6DAA2C;AAC3C,8CAA4B;AAC5B,+CAA6B;AAC7B,4CAA0B;AAC1B,sDAAoC;AACpC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,+CAA6B;AAC7B,sDAAoC;AACpC,wCAAsB;AACtB,kDAAgC;AAChC,8CAA4B;AAC5B,8CAA4B;AAC5B,oDAAkC;AAClC,4CAA0B;AAC1B,sDAAoC;AACpC,kDAAgC;AAChC,8DAA4C;AAC5C,qDAAmC;AACnC,iDAA+B;AAC/B,oDAAkC;AAClC,mDAAiC;AACjC,iDAA+B;AAC/B,iDAA+B;AAC/B,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AACpC,2CAAyB;AACzB,6CAA2B;AAC3B,wCAAsB;AACtB,4CAA0B;AAC1B,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,8CAA4B;AAC5B,wCAAsB;AACtB,wCAAsB;AACtB,kDAAgC;AAChC,gDAA8B;AAC9B,+CAA6B;AAC7B,8CAA4B;AAC5B,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { InputArray, int, OutputArray } from "./_types";
|
|
2
|
+
/**
|
|
3
|
+
* Applies a colormap on a given image.
|
|
4
|
+
*
|
|
5
|
+
* @param src The source image, which should be grayscale. Should be 8-bit, 16-bit, or floating-point.
|
|
6
|
+
* @param dst The result is the colored image.
|
|
7
|
+
* @param colormap The colormap to apply.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyColorMap(src: InputArray, dst: OutputArray, colormap: int): void;
|
|
10
|
+
/**
|
|
11
|
+
* Applies a user colormap on a given image.
|
|
12
|
+
*
|
|
13
|
+
* @param src The source image, which should be grayscale. Should be 8-bit, 16-bit, or floating-point.
|
|
14
|
+
* @param dst The result is the colored image.
|
|
15
|
+
* @param userColor The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyColorMap(src: InputArray, dst: OutputArray, userColor: InputArray): void;
|
|
18
|
+
/**
|
|
19
|
+
* Colormap types used by the applyColorMap function.
|
|
20
|
+
*/
|
|
21
|
+
export type ColormapTypes = any;
|
|
22
|
+
export declare const COLORMAP_AUTUMN: ColormapTypes;
|
|
23
|
+
export declare const COLORMAP_BONE: ColormapTypes;
|
|
24
|
+
export declare const COLORMAP_JET: ColormapTypes;
|
|
25
|
+
export declare const COLORMAP_WINTER: ColormapTypes;
|
|
26
|
+
export declare const COLORMAP_RAINBOW: ColormapTypes;
|
|
27
|
+
export declare const COLORMAP_OCEAN: ColormapTypes;
|
|
28
|
+
export declare const COLORMAP_SUMMER: ColormapTypes;
|
|
29
|
+
export declare const COLORMAP_SPRING: ColormapTypes;
|
|
30
|
+
export declare const COLORMAP_COOL: ColormapTypes;
|
|
31
|
+
export declare const COLORMAP_HSV: ColormapTypes;
|
|
32
|
+
export declare const COLORMAP_PINK: ColormapTypes;
|
|
33
|
+
export declare const COLORMAP_HOT: ColormapTypes;
|
|
34
|
+
export declare const COLORMAP_PARULA: ColormapTypes;
|
|
35
|
+
export declare const COLORMAP_MAGMA: ColormapTypes;
|
|
36
|
+
export declare const COLORMAP_INFERNO: ColormapTypes;
|
|
37
|
+
export declare const COLORMAP_PLASMA: ColormapTypes;
|
|
38
|
+
export declare const COLORMAP_VIRIDIS: ColormapTypes;
|
|
39
|
+
export declare const COLORMAP_CIVIDIS: ColormapTypes;
|
|
40
|
+
export declare const COLORMAP_TWILIGHT: ColormapTypes;
|
|
41
|
+
export declare const COLORMAP_TWILIGHT_SHIFTED: ColormapTypes;
|
|
42
|
+
export declare const COLORMAP_TURBO: ColormapTypes;
|
|
43
|
+
export declare const COLORMAP_DEEPGREEN: ColormapTypes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imgproc_colormap.js","sourceRoot":"","sources":["../../../../src/types/opencv/imgproc_colormap.ts"],"names":[],"mappings":""}
|
|
@@ -38,9 +38,9 @@ export declare function boundingRect(array: InputArray): Rect;
|
|
|
38
38
|
*
|
|
39
39
|
* @param box The input rotated rectangle. It may be the output of
|
|
40
40
|
*
|
|
41
|
-
* @
|
|
41
|
+
* @returns An array of four vertices of the rectangle (Point2f[])
|
|
42
42
|
*/
|
|
43
|
-
export declare function boxPoints(box: RotatedRect
|
|
43
|
+
export declare function boxPoints(box: RotatedRect): Point2f[];
|
|
44
44
|
/**
|
|
45
45
|
* image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
|
|
46
46
|
* represents the background label. ltype specifies the output label image type, an important
|
|
@@ -41,3 +41,5 @@ export declare const CASCADE_DO_CANNY_PRUNING: any;
|
|
|
41
41
|
export declare const CASCADE_SCALE_IMAGE: any;
|
|
42
42
|
export declare const CASCADE_FIND_BIGGEST_OBJECT: any;
|
|
43
43
|
export declare const CASCADE_DO_ROUGH_SEARCH: any;
|
|
44
|
+
export { QRCodeDetector } from "./QRCodeDetector";
|
|
45
|
+
export { QRCodeDetectorAruco, QRCodeDetectorAruco_Params, } from "./QRCodeDetectorAruco";
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QRCodeDetectorAruco_Params = exports.QRCodeDetectorAruco = exports.QRCodeDetector = void 0;
|
|
4
|
+
var QRCodeDetector_1 = require("./QRCodeDetector");
|
|
5
|
+
Object.defineProperty(exports, "QRCodeDetector", { enumerable: true, get: function () { return QRCodeDetector_1.QRCodeDetector; } });
|
|
6
|
+
var QRCodeDetectorAruco_1 = require("./QRCodeDetectorAruco");
|
|
7
|
+
Object.defineProperty(exports, "QRCodeDetectorAruco", { enumerable: true, get: function () { return QRCodeDetectorAruco_1.QRCodeDetectorAruco; } });
|
|
8
|
+
Object.defineProperty(exports, "QRCodeDetectorAruco_Params", { enumerable: true, get: function () { return QRCodeDetectorAruco_1.QRCodeDetectorAruco_Params; } });
|
|
3
9
|
//# sourceMappingURL=objdetect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objdetect.js","sourceRoot":"","sources":["../../../../src/types/opencv/objdetect.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"objdetect.js","sourceRoot":"","sources":["../../../../src/types/opencv/objdetect.ts"],"names":[],"mappings":";;;AAwGA,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,6DAG+B;AAF7B,0HAAA,mBAAmB,OAAA;AACnB,iIAAA,0BAA0B,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techstark/opencv-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-release.1",
|
|
4
4
|
"description": "OpenCV JavaScript version for node.js or browser",
|
|
5
5
|
"main": "dist/opencv.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -12,15 +12,16 @@
|
|
|
12
12
|
"build": "tsc",
|
|
13
13
|
"prepack": "npm run build",
|
|
14
14
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
15
|
-
"test": "jest"
|
|
15
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
16
|
+
"test:compat": "node test/compat/run-all.mjs"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"@types/jest": "^
|
|
19
|
-
"jest": "^
|
|
20
|
-
"jimp": "^1.6.
|
|
21
|
-
"prettier": "^3.
|
|
22
|
-
"ts-jest": "^29.
|
|
23
|
-
"typescript": "^
|
|
19
|
+
"@types/jest": "^30.0.0",
|
|
20
|
+
"jest": "^30.0.0",
|
|
21
|
+
"jimp": "^1.6.1",
|
|
22
|
+
"prettier": "^3.8.4",
|
|
23
|
+
"ts-jest": "^29.4.11",
|
|
24
|
+
"typescript": "^6.0.3"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Algorithm, bool, double, InputArray, OutputArray } from "./_types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base class for background/foreground segmentation algorithms.
|
|
5
|
+
*
|
|
6
|
+
* The class is only used to define the common interface for the whole family of background/foreground
|
|
7
|
+
* segmentation algorithms.
|
|
8
|
+
*
|
|
9
|
+
* Source:
|
|
10
|
+
* [opencv2/video.hpp](https://github.com/opencv/opencv/tree/master/modules/video/include/opencv2/video/background_segm.hpp).
|
|
11
|
+
*/
|
|
12
|
+
export declare class BackgroundSubtractor extends Algorithm {
|
|
13
|
+
public constructor();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Computes a foreground mask.
|
|
17
|
+
*
|
|
18
|
+
* @param image Next video frame.
|
|
19
|
+
* @param fgmask The output foreground mask as an 8-bit binary image.
|
|
20
|
+
* @param learningRate The value between 0 and 1 that indicates how fast the background model is learnt.
|
|
21
|
+
* Negative parameter value makes the algorithm use some automatically chosen learning rate.
|
|
22
|
+
* 0 means that the background model is not updated at all, 1 means that the background model is
|
|
23
|
+
* completely reinitialized from the last frame.
|
|
24
|
+
*/
|
|
25
|
+
public apply(image: InputArray, fgmask: OutputArray, learningRate?: double): void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Computes a background image.
|
|
29
|
+
*
|
|
30
|
+
* @param backgroundImage The output background image.
|
|
31
|
+
*
|
|
32
|
+
* @note Sometimes the background image can be very blurry, as it contain the average background
|
|
33
|
+
* statistics.
|
|
34
|
+
*/
|
|
35
|
+
public getBackgroundImage(backgroundImage: OutputArray): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BackgroundSubtractor, bool, double, int } from "./_types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
|
|
5
|
+
*
|
|
6
|
+
* The class implements the Gaussian mixture model background subtraction described in [Zivkovic2004]
|
|
7
|
+
* and [Zivkovic2006].
|
|
8
|
+
*
|
|
9
|
+
* Source:
|
|
10
|
+
* [opencv2/video.hpp](https://github.com/opencv/opencv/tree/master/modules/video/include/opencv2/video/background_segm.hpp).
|
|
11
|
+
*/
|
|
12
|
+
export declare class BackgroundSubtractorMOG2 extends BackgroundSubtractor {
|
|
13
|
+
/**
|
|
14
|
+
* @param history Length of the history.
|
|
15
|
+
* @param varThreshold Threshold on the squared Mahalanobis distance between the pixel and the model
|
|
16
|
+
* to decide whether a pixel is well described by the background model. This parameter does not
|
|
17
|
+
* affect the background update.
|
|
18
|
+
* @param detectShadows If true, the algorithm will detect shadows and mark them. It decreases the
|
|
19
|
+
* speed a bit, so if you do not need this feature, set the parameter to false.
|
|
20
|
+
*/
|
|
21
|
+
public constructor(history?: int, varThreshold?: double, detectShadows?: bool);
|
|
22
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Algorithm, KeyPointVector, Mat, OutputArray } from "./_types";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* https://docs.opencv.org/
|
|
4
|
+
* https://docs.opencv.org/master/d0/d13/classcv_1_1Feature2D.html
|
|
5
5
|
*/
|
|
6
6
|
export declare class Feature2D extends Algorithm {
|
|
7
7
|
/**
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
bool,
|
|
3
|
+
DescriptorMatcher,
|
|
4
|
+
FileNode,
|
|
5
|
+
FileStorage,
|
|
6
|
+
InputArrayOfArrays,
|
|
7
|
+
Ptr,
|
|
8
|
+
} from "./_types";
|
|
2
9
|
|
|
3
10
|
/**
|
|
4
11
|
* This matcher trains [cv::flann::Index](#d1/db2/classcv_1_1flann_1_1Index}) on a train descriptor
|
package/src/types/opencv/Mat.ts
CHANGED
|
@@ -787,6 +787,12 @@ export declare class Mat extends EmscriptenEmbindInstance {
|
|
|
787
787
|
*/
|
|
788
788
|
public clone(): Mat;
|
|
789
789
|
|
|
790
|
+
/**
|
|
791
|
+
* Creates a deep copy of the Mat with independent data buffer.
|
|
792
|
+
* This method ensures the copied Mat has its own data that is independent of the original.
|
|
793
|
+
*/
|
|
794
|
+
public mat_clone(): Mat;
|
|
795
|
+
|
|
790
796
|
/**
|
|
791
797
|
* The method makes a new header for the specified matrix column and returns it. This is an O(1)
|
|
792
798
|
* operation, regardless of the matrix size. The underlying data of the new matrix is shared with the
|
|
@@ -1595,7 +1601,7 @@ export declare class Mat extends EmscriptenEmbindInstance {
|
|
|
1595
1601
|
|
|
1596
1602
|
public updateContinuityFlag(): void;
|
|
1597
1603
|
|
|
1598
|
-
public ucharPtr(i: any, j
|
|
1604
|
+
public ucharPtr(i: any, j?: any): any;
|
|
1599
1605
|
public charPtr(i: any, j: any): any;
|
|
1600
1606
|
public shortPtr(i: any, j: any): any;
|
|
1601
1607
|
public ushortPtr(i: any, j: any): any;
|
package/src/types/opencv/ORB.ts
CHANGED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
bool,
|
|
3
|
+
InputArray,
|
|
4
|
+
InputOutputArray,
|
|
5
|
+
OutputArray,
|
|
6
|
+
OutputArrayOfArrays,
|
|
7
|
+
Point2f,
|
|
8
|
+
} from "./_types";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* QR Code detection and decoding class.
|
|
12
|
+
*
|
|
13
|
+
* This class implements QR code detection and decoding functionality.
|
|
14
|
+
* It can detect QR codes in an image and decode their content.
|
|
15
|
+
*
|
|
16
|
+
* Source:
|
|
17
|
+
* [opencv2/objdetect.hpp](https://github.com/opencv/opencv/tree/master/modules/objdetect/include/opencv2/objdetect.hpp).
|
|
18
|
+
*/
|
|
19
|
+
export declare class QRCodeDetector {
|
|
20
|
+
/**
|
|
21
|
+
* QRCodeDetector constructor
|
|
22
|
+
*/
|
|
23
|
+
public constructor();
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Detects QR code in image and returns the quadrangle containing the code.
|
|
27
|
+
*
|
|
28
|
+
* @param img grayscale or color (BGR) image containing (or not) QR code.
|
|
29
|
+
* @param points Output vector of vertices of the minimum-area quadrangle containing the code.
|
|
30
|
+
*/
|
|
31
|
+
public detect(img: InputArray, points: OutputArray): bool;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Decodes QR code in image once it's found by the detect() method.
|
|
35
|
+
*
|
|
36
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
37
|
+
* @param points Quadrangle vertices found by detect() method (or some other algorithm).
|
|
38
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
39
|
+
*/
|
|
40
|
+
public decode(
|
|
41
|
+
img: InputArray,
|
|
42
|
+
points: InputArray,
|
|
43
|
+
straight_qrcode?: OutputArray,
|
|
44
|
+
): String;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Both detects and decodes QR code
|
|
48
|
+
*
|
|
49
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
50
|
+
* @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found.
|
|
51
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
52
|
+
*/
|
|
53
|
+
public detectAndDecode(
|
|
54
|
+
img: InputArray,
|
|
55
|
+
points?: OutputArray,
|
|
56
|
+
straight_qrcode?: OutputArray,
|
|
57
|
+
): String;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Detects QR codes in image and returns the vector of the quadrangles containing the codes.
|
|
61
|
+
*
|
|
62
|
+
* @param img grayscale or color (BGR) image containing (or not) QR codes.
|
|
63
|
+
* @param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes.
|
|
64
|
+
*/
|
|
65
|
+
public detectMulti(img: InputArray, points: OutputArrayOfArrays): bool;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Decodes QR codes in image once it's found by the detectMulti() method.
|
|
69
|
+
*
|
|
70
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
71
|
+
* @param points vector of Quadrangle vertices found by detectMulti() method (or some other algorithm).
|
|
72
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
73
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
74
|
+
*/
|
|
75
|
+
public decodeMulti(
|
|
76
|
+
img: InputArray,
|
|
77
|
+
points: InputArray,
|
|
78
|
+
decoded_info: any,
|
|
79
|
+
straight_qrcode?: OutputArrayOfArrays,
|
|
80
|
+
): bool;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Both detects and decodes QR codes
|
|
84
|
+
*
|
|
85
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
86
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
87
|
+
* @param points optional output vector of vertices of the found QR code quadrangles. Will be empty if not found.
|
|
88
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
89
|
+
*/
|
|
90
|
+
public detectAndDecodeMulti(
|
|
91
|
+
img: InputArray,
|
|
92
|
+
decoded_info: any,
|
|
93
|
+
points?: OutputArrayOfArrays,
|
|
94
|
+
straight_qrcode?: OutputArrayOfArrays,
|
|
95
|
+
): bool;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Aruco-based QR code detector
|
|
99
|
+
*/
|
|
100
|
+
public setUseAruco(use_aruco: bool): void;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get if Aruco-based QR code detector is used
|
|
104
|
+
*/
|
|
105
|
+
public getUseAruco(): bool;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Releases the object
|
|
109
|
+
*/
|
|
110
|
+
public delete(): void;
|
|
111
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
bool,
|
|
3
|
+
float,
|
|
4
|
+
InputArray,
|
|
5
|
+
OutputArray,
|
|
6
|
+
OutputArrayOfArrays,
|
|
7
|
+
} from "./_types";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for QRCodeDetectorAruco
|
|
11
|
+
*/
|
|
12
|
+
export declare class QRCodeDetectorAruco_Params {
|
|
13
|
+
public minModuleSizeInPyramid: float;
|
|
14
|
+
public maxRotation: float;
|
|
15
|
+
public maxModuleSizeMismatch: float;
|
|
16
|
+
public maxTimingPatternMismatch: float;
|
|
17
|
+
public maxPenalties: float;
|
|
18
|
+
public maxColorsMismatch: float;
|
|
19
|
+
public scaleTimingPatternScore: float;
|
|
20
|
+
|
|
21
|
+
public constructor();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Releases the object
|
|
25
|
+
*/
|
|
26
|
+
public delete(): void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* QR Code detection and decoding class using Aruco-based detection.
|
|
31
|
+
*
|
|
32
|
+
* This class implements QR code detection and decoding functionality using
|
|
33
|
+
* Aruco marker detection techniques for improved robustness.
|
|
34
|
+
*
|
|
35
|
+
* Source:
|
|
36
|
+
* [opencv2/objdetect.hpp](https://github.com/opencv/opencv/tree/master/modules/objdetect/include/opencv2/objdetect.hpp).
|
|
37
|
+
*/
|
|
38
|
+
export declare class QRCodeDetectorAruco {
|
|
39
|
+
/**
|
|
40
|
+
* QRCodeDetectorAruco constructor
|
|
41
|
+
*/
|
|
42
|
+
public constructor();
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* QRCodeDetectorAruco constructor with parameters
|
|
46
|
+
*
|
|
47
|
+
* @param params QRCodeDetectorAruco parameters
|
|
48
|
+
*/
|
|
49
|
+
public constructor(params: QRCodeDetectorAruco_Params);
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Detects QR code in image and returns the quadrangle containing the code.
|
|
53
|
+
*
|
|
54
|
+
* @param img grayscale or color (BGR) image containing (or not) QR code.
|
|
55
|
+
* @param points Output vector of vertices of the minimum-area quadrangle containing the code.
|
|
56
|
+
*/
|
|
57
|
+
public detect(img: InputArray, points: OutputArray): bool;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Decodes QR code in image once it's found by the detect() method.
|
|
61
|
+
*
|
|
62
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
63
|
+
* @param points Quadrangle vertices found by detect() method (or some other algorithm).
|
|
64
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
65
|
+
*/
|
|
66
|
+
public decode(
|
|
67
|
+
img: InputArray,
|
|
68
|
+
points: InputArray,
|
|
69
|
+
straight_qrcode?: OutputArray,
|
|
70
|
+
): String;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Both detects and decodes QR code
|
|
74
|
+
*
|
|
75
|
+
* @param img grayscale or color (BGR) image containing QR code.
|
|
76
|
+
* @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found.
|
|
77
|
+
* @param straight_qrcode The optional output image containing rectified and binarized QR code
|
|
78
|
+
*/
|
|
79
|
+
public detectAndDecode(
|
|
80
|
+
img: InputArray,
|
|
81
|
+
points?: OutputArray,
|
|
82
|
+
straight_qrcode?: OutputArray,
|
|
83
|
+
): String;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Detects QR codes in image and returns the vector of the quadrangles containing the codes.
|
|
87
|
+
*
|
|
88
|
+
* @param img grayscale or color (BGR) image containing (or not) QR codes.
|
|
89
|
+
* @param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes.
|
|
90
|
+
*/
|
|
91
|
+
public detectMulti(img: InputArray, points: OutputArrayOfArrays): bool;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Decodes QR codes in image once it's found by the detectMulti() method.
|
|
95
|
+
*
|
|
96
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
97
|
+
* @param points vector of Quadrangle vertices found by detectMulti() method (or some other algorithm).
|
|
98
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
99
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
100
|
+
*/
|
|
101
|
+
public decodeMulti(
|
|
102
|
+
img: InputArray,
|
|
103
|
+
points: InputArray,
|
|
104
|
+
decoded_info: any,
|
|
105
|
+
straight_qrcode?: OutputArrayOfArrays,
|
|
106
|
+
): bool;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Both detects and decodes QR codes
|
|
110
|
+
*
|
|
111
|
+
* @param img grayscale or color (BGR) image containing QR codes.
|
|
112
|
+
* @param decoded_info UTF8-encoded output vector of String or empty vector of String if the codes cannot be decoded.
|
|
113
|
+
* @param points optional output vector of vertices of the found QR code quadrangles. Will be empty if not found.
|
|
114
|
+
* @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes
|
|
115
|
+
*/
|
|
116
|
+
public detectAndDecodeMulti(
|
|
117
|
+
img: InputArray,
|
|
118
|
+
decoded_info: any,
|
|
119
|
+
points?: OutputArrayOfArrays,
|
|
120
|
+
straight_qrcode?: OutputArrayOfArrays,
|
|
121
|
+
): bool;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Get detector parameters
|
|
125
|
+
*/
|
|
126
|
+
public getDetectorParameters(): QRCodeDetectorAruco_Params;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Set detector parameters
|
|
130
|
+
*
|
|
131
|
+
* @param params QRCodeDetectorAruco parameters
|
|
132
|
+
*/
|
|
133
|
+
public setDetectorParameters(params: QRCodeDetectorAruco_Params): void;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Releases the object
|
|
137
|
+
*/
|
|
138
|
+
public delete(): void;
|
|
139
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./Affine3";
|
|
2
2
|
export * from "./Algorithm";
|
|
3
3
|
export * from "./AutoBuffer";
|
|
4
|
+
export * from "./BackgroundSubtractor";
|
|
5
|
+
export * from "./BackgroundSubtractorMOG2";
|
|
4
6
|
export * from "./BFMatcher";
|
|
5
7
|
export * from "./BOWTrainer";
|
|
6
8
|
export * from "./calib3d";
|
|
@@ -19,6 +21,7 @@ export * from "./fisheye";
|
|
|
19
21
|
export * from "./FlannBasedMatcher";
|
|
20
22
|
export * from "./HOGDescriptor";
|
|
21
23
|
export * from "./imgproc_color_conversions";
|
|
24
|
+
export * from "./imgproc_colormap";
|
|
22
25
|
export * from "./imgproc_draw";
|
|
23
26
|
export * from "./imgproc_feature";
|
|
24
27
|
export * from "./imgproc_filter";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { InputArray, int, OutputArray } from "./_types";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* # Colormap Transformations
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Applies a colormap on a given image.
|
|
10
|
+
*
|
|
11
|
+
* @param src The source image, which should be grayscale. Should be 8-bit, 16-bit, or floating-point.
|
|
12
|
+
* @param dst The result is the colored image.
|
|
13
|
+
* @param colormap The colormap to apply.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyColorMap(
|
|
16
|
+
src: InputArray,
|
|
17
|
+
dst: OutputArray,
|
|
18
|
+
colormap: int,
|
|
19
|
+
): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Applies a user colormap on a given image.
|
|
23
|
+
*
|
|
24
|
+
* @param src The source image, which should be grayscale. Should be 8-bit, 16-bit, or floating-point.
|
|
25
|
+
* @param dst The result is the colored image.
|
|
26
|
+
* @param userColor The colormap to apply of type CV_8UC1 or CV_8UC3 and size 256.
|
|
27
|
+
*/
|
|
28
|
+
export declare function applyColorMap(
|
|
29
|
+
src: InputArray,
|
|
30
|
+
dst: OutputArray,
|
|
31
|
+
userColor: InputArray,
|
|
32
|
+
): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Colormap types used by the applyColorMap function.
|
|
36
|
+
*/
|
|
37
|
+
export type ColormapTypes = any;
|
|
38
|
+
|
|
39
|
+
export declare const COLORMAP_AUTUMN: ColormapTypes; // initializer: = 0
|
|
40
|
+
export declare const COLORMAP_BONE: ColormapTypes; // initializer: = 1
|
|
41
|
+
export declare const COLORMAP_JET: ColormapTypes; // initializer: = 2
|
|
42
|
+
export declare const COLORMAP_WINTER: ColormapTypes; // initializer: = 3
|
|
43
|
+
export declare const COLORMAP_RAINBOW: ColormapTypes; // initializer: = 4
|
|
44
|
+
export declare const COLORMAP_OCEAN: ColormapTypes; // initializer: = 5
|
|
45
|
+
export declare const COLORMAP_SUMMER: ColormapTypes; // initializer: = 6
|
|
46
|
+
export declare const COLORMAP_SPRING: ColormapTypes; // initializer: = 7
|
|
47
|
+
export declare const COLORMAP_COOL: ColormapTypes; // initializer: = 8
|
|
48
|
+
export declare const COLORMAP_HSV: ColormapTypes; // initializer: = 9
|
|
49
|
+
export declare const COLORMAP_PINK: ColormapTypes; // initializer: = 10
|
|
50
|
+
export declare const COLORMAP_HOT: ColormapTypes; // initializer: = 11
|
|
51
|
+
export declare const COLORMAP_PARULA: ColormapTypes; // initializer: = 12
|
|
52
|
+
export declare const COLORMAP_MAGMA: ColormapTypes; // initializer: = 13
|
|
53
|
+
export declare const COLORMAP_INFERNO: ColormapTypes; // initializer: = 14
|
|
54
|
+
export declare const COLORMAP_PLASMA: ColormapTypes; // initializer: = 15
|
|
55
|
+
export declare const COLORMAP_VIRIDIS: ColormapTypes; // initializer: = 16
|
|
56
|
+
export declare const COLORMAP_CIVIDIS: ColormapTypes; // initializer: = 17
|
|
57
|
+
export declare const COLORMAP_TWILIGHT: ColormapTypes; // initializer: = 18
|
|
58
|
+
export declare const COLORMAP_TWILIGHT_SHIFTED: ColormapTypes; // initializer: = 19
|
|
59
|
+
export declare const COLORMAP_TURBO: ColormapTypes; // initializer: = 20
|
|
60
|
+
export declare const COLORMAP_DEEPGREEN: ColormapTypes; // initializer: = 21
|
|
@@ -65,9 +65,9 @@ export declare function boundingRect(array: InputArray): Rect;
|
|
|
65
65
|
*
|
|
66
66
|
* @param box The input rotated rectangle. It may be the output of
|
|
67
67
|
*
|
|
68
|
-
* @
|
|
68
|
+
* @returns An array of four vertices of the rectangle (Point2f[])
|
|
69
69
|
*/
|
|
70
|
-
export declare function boxPoints(box: RotatedRect
|
|
70
|
+
export declare function boxPoints(box: RotatedRect): Point2f[];
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0
|
|
@@ -533,9 +533,7 @@ export declare function minAreaRect(points: InputArray): RotatedRect;
|
|
|
533
533
|
*
|
|
534
534
|
* @param points Input vector of 2D points, stored in std::vector<> or Mat
|
|
535
535
|
*/
|
|
536
|
-
export declare function minEnclosingCircle(
|
|
537
|
-
points: InputArray,
|
|
538
|
-
): Circle;
|
|
536
|
+
export declare function minEnclosingCircle(points: InputArray): Circle;
|
|
539
537
|
|
|
540
538
|
/**
|
|
541
539
|
* The function finds a triangle of minimum area enclosing the given set of 2D points and returns its
|
|
@@ -101,3 +101,9 @@ export declare const CASCADE_SCALE_IMAGE: any; // initializer: = 2
|
|
|
101
101
|
export declare const CASCADE_FIND_BIGGEST_OBJECT: any; // initializer: = 4
|
|
102
102
|
|
|
103
103
|
export declare const CASCADE_DO_ROUGH_SEARCH: any; // initializer: = 8
|
|
104
|
+
|
|
105
|
+
export { QRCodeDetector } from "./QRCodeDetector";
|
|
106
|
+
export {
|
|
107
|
+
QRCodeDetectorAruco,
|
|
108
|
+
QRCodeDetectorAruco_Params,
|
|
109
|
+
} from "./QRCodeDetectorAruco";
|