@repeato/native-cv 0.2.0 → 0.2.2
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.internal.md
CHANGED
|
@@ -8,7 +8,7 @@ Native OpenCV-based template matching module for Node.js with static linking for
|
|
|
8
8
|
- **Electron Ready**: Pre-built for Electron applications
|
|
9
9
|
- **Cross-Platform**: Supports macOS, Windows, and Linux
|
|
10
10
|
- **Template Matching**: High-performance template matching using OpenCV
|
|
11
|
-
- **
|
|
11
|
+
- **ORB Features**: Advanced feature detection and matching
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -27,8 +27,8 @@ npm run build:electron
|
|
|
27
27
|
```javascript
|
|
28
28
|
const native = require('./build/Release/repeato-native-cv.node');
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
const sof = new native.
|
|
30
|
+
// OrbObjectFinder requires parameters
|
|
31
|
+
const sof = new native.OrbObjectFinder({
|
|
32
32
|
kMinMatches: 10, // Minimum matches required
|
|
33
33
|
goodMatchTh: 0.75, // Good match threshold (0.0-1.0)
|
|
34
34
|
clusterSearchRadius: 50 // Cluster search radius in pixels
|
|
@@ -44,7 +44,7 @@ const tmw = new native.TemplateMatcher();
|
|
|
44
44
|
const path = require('path');
|
|
45
45
|
const native = require(path.join(__dirname, 'native', 'repeato-native-cv.node'));
|
|
46
46
|
|
|
47
|
-
const sof = new native.
|
|
47
|
+
const sof = new native.OrbObjectFinder({
|
|
48
48
|
kMinMatches: 10,
|
|
49
49
|
goodMatchTh: 0.75,
|
|
50
50
|
clusterSearchRadius: 50
|
|
@@ -129,7 +129,7 @@ repeato-native-cv/
|
|
|
129
129
|
├── src/
|
|
130
130
|
│ ├── module.cc # Main N-API module
|
|
131
131
|
│ ├── template_matcher.cc # Template matching implementation
|
|
132
|
-
│ └──
|
|
132
|
+
│ └── orb_object_finder.cc # ORB object detection
|
|
133
133
|
├── scripts/
|
|
134
134
|
│ ├── download-opencv.js # OpenCV download/build
|
|
135
135
|
│ ├── build-electron.js # Electron build script
|
package/index.d.ts
CHANGED
|
@@ -67,8 +67,11 @@ export function calcImageDiffPercentage(options: CalcImageDiffPercentageOptions)
|
|
|
67
67
|
/** Thread-safe template matching using per-call native instances. */
|
|
68
68
|
export function findObjectViaTemplate(options: FindObjectViaTemplateOptions): Promise<MatchResult[]>;
|
|
69
69
|
|
|
70
|
-
/** Thread-safe
|
|
71
|
-
export function
|
|
70
|
+
/** Thread-safe ORB matching using per-call native instances. */
|
|
71
|
+
export function findObjectViaOrb(options: FindObjectViaOrbOptions): Promise<ObjectResult[]>;
|
|
72
|
+
|
|
73
|
+
/** Smart finder that combines template matching with ORB/SIFT support scoring. */
|
|
74
|
+
export function findObjectSmart(options: FindObjectSmartOptions): Promise<MatchResult[]>;
|
|
72
75
|
|
|
73
76
|
export interface FindObjectViaTemplateOptions {
|
|
74
77
|
templateBuffer: Buffer;
|
|
@@ -83,7 +86,7 @@ export interface FindObjectViaTemplateOptions {
|
|
|
83
86
|
debug?: boolean;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
export interface
|
|
89
|
+
export interface FindObjectViaOrbOptions {
|
|
87
90
|
templateBuffer: Buffer;
|
|
88
91
|
frameBuffer: Buffer;
|
|
89
92
|
minMatches: number;
|
|
@@ -96,6 +99,14 @@ export interface FindObjectViaSiftOptions {
|
|
|
96
99
|
debug?: boolean;
|
|
97
100
|
}
|
|
98
101
|
|
|
102
|
+
export interface FindObjectSmartOptions extends FindObjectViaTemplateOptions {
|
|
103
|
+
kMinMatches?: number;
|
|
104
|
+
goodMatchTh?: number;
|
|
105
|
+
clusterSearchRadius?: number;
|
|
106
|
+
smartRelaxedAccuracy?: number;
|
|
107
|
+
smartUseOrbForNonScaleInvariant?: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
99
110
|
export interface DiffBoundingBox {
|
|
100
111
|
x: number;
|
|
101
112
|
y: number;
|
package/index.js
CHANGED
|
@@ -328,8 +328,8 @@ const findObjectViaTemplate = async options => {
|
|
|
328
328
|
}])
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
const
|
|
332
|
-
assertOptionsObject(options, '
|
|
331
|
+
const findObjectViaOrb = async options => {
|
|
332
|
+
assertOptionsObject(options, 'findObjectViaOrb')
|
|
333
333
|
const {
|
|
334
334
|
templateBuffer,
|
|
335
335
|
frameBuffer,
|
|
@@ -342,7 +342,7 @@ const findObjectViaSift = async options => {
|
|
|
342
342
|
roi,
|
|
343
343
|
debug = false
|
|
344
344
|
} = options
|
|
345
|
-
return runNative('
|
|
345
|
+
return runNative('findObjectViaOrb', [{
|
|
346
346
|
templateBuffer: toBuffer(templateBuffer, 'templateBuffer'),
|
|
347
347
|
frameBuffer: toBuffer(frameBuffer, 'frameBuffer'),
|
|
348
348
|
minMatches,
|
|
@@ -356,6 +356,45 @@ const findObjectViaSift = async options => {
|
|
|
356
356
|
}])
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
const findObjectSmart = async options => {
|
|
360
|
+
assertOptionsObject(options, 'findObjectSmart')
|
|
361
|
+
const {
|
|
362
|
+
templateBuffer,
|
|
363
|
+
frameBuffer,
|
|
364
|
+
minMatches,
|
|
365
|
+
optimalMatches,
|
|
366
|
+
timeout,
|
|
367
|
+
resolutionFixScale = 1,
|
|
368
|
+
scaleInvariant = false,
|
|
369
|
+
accuracy = 1,
|
|
370
|
+
kMinMatches = 10,
|
|
371
|
+
goodMatchTh = 0.75,
|
|
372
|
+
clusterSearchRadius = 50,
|
|
373
|
+
smartRelaxedAccuracy,
|
|
374
|
+
smartUseOrbForNonScaleInvariant,
|
|
375
|
+
roi,
|
|
376
|
+
debug = false
|
|
377
|
+
} = options
|
|
378
|
+
|
|
379
|
+
return runNative('findObjectSmart', [{
|
|
380
|
+
templateBuffer: toBuffer(templateBuffer, 'templateBuffer'),
|
|
381
|
+
frameBuffer: toBuffer(frameBuffer, 'frameBuffer'),
|
|
382
|
+
minMatches,
|
|
383
|
+
optimalMatches,
|
|
384
|
+
timeout,
|
|
385
|
+
resolutionFixScale,
|
|
386
|
+
scaleInvariant,
|
|
387
|
+
accuracy,
|
|
388
|
+
kMinMatches,
|
|
389
|
+
goodMatchTh,
|
|
390
|
+
clusterSearchRadius,
|
|
391
|
+
smartRelaxedAccuracy,
|
|
392
|
+
smartUseOrbForNonScaleInvariant,
|
|
393
|
+
roi,
|
|
394
|
+
debug
|
|
395
|
+
}])
|
|
396
|
+
}
|
|
397
|
+
|
|
359
398
|
const shutdown = async () => {
|
|
360
399
|
if (nativeCvPool) {
|
|
361
400
|
await nativeCvPool.shutdown()
|
|
@@ -370,7 +409,8 @@ module.exports = {
|
|
|
370
409
|
calcImageDiffBoundingBox,
|
|
371
410
|
calcImageDiffPercentage,
|
|
372
411
|
findObjectViaTemplate,
|
|
373
|
-
|
|
412
|
+
findObjectViaOrb,
|
|
413
|
+
findObjectSmart,
|
|
374
414
|
shutdown,
|
|
375
415
|
|
|
376
416
|
// JavaScript wrapper classes
|
|
@@ -384,7 +424,8 @@ module.exports = {
|
|
|
384
424
|
calcImageDiffBoundingBox,
|
|
385
425
|
calcImageDiffPercentage,
|
|
386
426
|
findObjectViaTemplate,
|
|
387
|
-
|
|
427
|
+
findObjectViaOrb,
|
|
428
|
+
findObjectSmart,
|
|
388
429
|
shutdown
|
|
389
430
|
}
|
|
390
431
|
};
|
package/native.js
CHANGED
|
@@ -37,11 +37,11 @@ if (!native) {
|
|
|
37
37
|
calcImageDiffBoundingBox: makeMissing('calcImageDiffBoundingBox'),
|
|
38
38
|
calcImageDiffPercentage: makeMissing('calcImageDiffPercentage'),
|
|
39
39
|
findObjectViaTemplate: makeMissing('findObjectViaTemplate'),
|
|
40
|
-
|
|
40
|
+
findObjectViaOrb: makeMissing('findObjectViaOrb')
|
|
41
41
|
}
|
|
42
42
|
} else {
|
|
43
43
|
// Ensure expected helper exports are present; if not, provide explicit error placeholders.
|
|
44
|
-
const expected = ['getMeanStdDev', 'getImageSize', 'calcImageDiffBoundingBox', 'calcImageDiffPercentage', 'findObjectViaTemplate', '
|
|
44
|
+
const expected = ['getMeanStdDev', 'getImageSize', 'calcImageDiffBoundingBox', 'calcImageDiffPercentage', 'findObjectViaTemplate', 'findObjectViaOrb']
|
|
45
45
|
for (const key of expected) {
|
|
46
46
|
if (!Object.prototype.hasOwnProperty.call(native, key)) {
|
|
47
47
|
const msg = `Native build missing expected export '${key}'.`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repeato/native-cv",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Native OpenCV-based template matching module for Node.js, replacing opencv4nodejs-m1.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"url": "git+https://github.com/repeato-qa/repeato-native-cv.git"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"jimp": "^0.22.12",
|
|
40
41
|
"node-addon-api": "^7.0.0",
|
|
41
42
|
"node-gyp-build": "^4.8.4"
|
|
42
43
|
},
|
|
Binary file
|
|
Binary file
|