@camera.ui/camera-ui-rust-motion 0.0.14 → 0.0.15
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/dist/defaults.d.ts +2 -2
- package/dist/defaults.js +2 -2
- package/dist/defaults.js.map +1 -1
- package/dist/detector.d.ts +9 -6
- package/dist/detector.js +77 -45
- package/dist/detector.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +9 -1
- package/dist/utils/addon.d.ts +3 -0
- package/dist/utils/addon.js +59 -0
- package/dist/utils/addon.js.map +1 -0
- package/package.json +43 -30
- package/dist/rust_detector_macos.node +0 -0
package/dist/defaults.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const DEFAULT_MOTION_AREA = 400;
|
|
2
2
|
export declare const DEFAULT_THRESHOLD = 50;
|
|
3
|
-
export declare const DEFAULT_BLUR_RADIUS =
|
|
4
|
-
export declare const DEFAULT_DILATION_SIZE =
|
|
3
|
+
export declare const DEFAULT_BLUR_RADIUS = 5;
|
|
4
|
+
export declare const DEFAULT_DILATION_SIZE = 5;
|
package/dist/defaults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const DEFAULT_MOTION_AREA = 400;
|
|
2
2
|
export const DEFAULT_THRESHOLD = 50;
|
|
3
|
-
export const DEFAULT_BLUR_RADIUS =
|
|
4
|
-
export const DEFAULT_DILATION_SIZE =
|
|
3
|
+
export const DEFAULT_BLUR_RADIUS = 5;
|
|
4
|
+
export const DEFAULT_DILATION_SIZE = 5;
|
|
5
5
|
//# sourceMappingURL=defaults.js.map
|
package/dist/defaults.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC"}
|
package/dist/detector.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import type { CameraDevice, CameraStorage,
|
|
2
|
-
import type
|
|
1
|
+
import type { CameraDevice, CameraStorage, PluginAPI } from '@camera.ui/types';
|
|
2
|
+
import { type CameraStorageValues } from './types.js';
|
|
3
3
|
export declare class CameraDetector {
|
|
4
4
|
cameraStorage: CameraStorage<CameraStorageValues>;
|
|
5
5
|
private api;
|
|
6
6
|
private cameraDevice;
|
|
7
|
-
private
|
|
7
|
+
private cameraLogger;
|
|
8
8
|
private started;
|
|
9
9
|
private closed;
|
|
10
10
|
private restarting;
|
|
11
|
-
|
|
11
|
+
private imageProcessor;
|
|
12
|
+
constructor(cameraDevice: CameraDevice, api: PluginAPI);
|
|
12
13
|
start(): Promise<void>;
|
|
13
|
-
private startDetection;
|
|
14
14
|
close(): void;
|
|
15
|
-
|
|
15
|
+
private startDetection;
|
|
16
|
+
private restart;
|
|
17
|
+
private detect;
|
|
18
|
+
private defaultSettings;
|
|
16
19
|
private createCameraStorage;
|
|
17
20
|
}
|
package/dist/detector.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
1
|
import { DEFAULT_BLUR_RADIUS, DEFAULT_DILATION_SIZE, DEFAULT_MOTION_AREA, DEFAULT_THRESHOLD } from './defaults.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const addonPath = join(__dirname, 'rust_detector_macos.node');
|
|
9
|
-
const addon = require(addonPath);
|
|
2
|
+
import { getAddon } from './utils/addon.js';
|
|
3
|
+
import {} from './types.js';
|
|
4
|
+
const addon = getAddon();
|
|
10
5
|
export class CameraDetector {
|
|
11
6
|
cameraStorage;
|
|
12
7
|
api;
|
|
13
8
|
cameraDevice;
|
|
14
|
-
|
|
9
|
+
cameraLogger;
|
|
15
10
|
started = false;
|
|
16
11
|
closed = false;
|
|
17
12
|
restarting = false;
|
|
18
|
-
|
|
13
|
+
imageProcessor;
|
|
14
|
+
constructor(cameraDevice, api) {
|
|
19
15
|
this.api = api;
|
|
20
16
|
this.cameraDevice = cameraDevice;
|
|
21
|
-
this.
|
|
17
|
+
this.cameraLogger = cameraDevice.logger;
|
|
22
18
|
this.cameraStorage = this.createCameraStorage();
|
|
19
|
+
if (!addon) {
|
|
20
|
+
this.cameraLogger.error(this.cameraDevice.name, `Failed to load motion detection addon! Platform: ${process.platform}, Arch: ${process.arch}`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.imageProcessor = new addon.ImageProcessor();
|
|
23
24
|
this.cameraDevice.onConnected.subscribe((connected) => {
|
|
24
25
|
if (connected) {
|
|
25
26
|
this.start();
|
|
@@ -33,14 +34,45 @@ export class CameraDetector {
|
|
|
33
34
|
if (!this.started) {
|
|
34
35
|
this.started = true;
|
|
35
36
|
this.closed = false;
|
|
36
|
-
this.
|
|
37
|
-
this.startDetection()
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
this.cameraLogger.log(this.cameraDevice.name, 'Starting motion detection');
|
|
38
|
+
await this.startDetection();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
close() {
|
|
42
|
+
if (!this.closed) {
|
|
43
|
+
this.started = false;
|
|
44
|
+
this.closed = true;
|
|
45
|
+
this.cameraLogger.log(this.cameraDevice.name, 'Stopping motion detection');
|
|
46
|
+
this.imageProcessor.resetState();
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
49
|
async startDetection() {
|
|
50
|
+
try {
|
|
51
|
+
await this.detect();
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.imageProcessor.resetState();
|
|
55
|
+
this.cameraLogger.error(this.cameraDevice.name, 'Error generating frames', error);
|
|
56
|
+
await this.restart();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async restart() {
|
|
60
|
+
if (this.restarting || this.closed) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.restarting = true;
|
|
64
|
+
this.cameraLogger.log(this.cameraDevice.name, 'Restarting motion detection in 2s...');
|
|
65
|
+
this.imageProcessor.resetState();
|
|
66
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
67
|
+
this.restarting = false;
|
|
68
|
+
if (this.cameraDevice.connected && !this.closed) {
|
|
69
|
+
await this.startDetection();
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.cameraLogger.log(this.cameraDevice.name, 'Camera is not connected, skipping restart');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async detect() {
|
|
44
76
|
for await (const frame of this.cameraDevice.getFrames()) {
|
|
45
77
|
if (this.closed || this.restarting) {
|
|
46
78
|
break;
|
|
@@ -56,13 +88,17 @@ export class CameraDetector {
|
|
|
56
88
|
format: {
|
|
57
89
|
to: 'gray',
|
|
58
90
|
},
|
|
91
|
+
resize: {
|
|
92
|
+
width: 640,
|
|
93
|
+
height: 0,
|
|
94
|
+
},
|
|
59
95
|
});
|
|
60
96
|
if (this.closed || this.restarting) {
|
|
61
97
|
break;
|
|
62
98
|
}
|
|
63
99
|
const detections = [];
|
|
64
100
|
const { width, height } = frameImage.info;
|
|
65
|
-
const boundingBoxes =
|
|
101
|
+
const boundingBoxes = this.imageProcessor.processImage(frameImage.image, width, height, threshold, blurRadius, dilationSize, motionArea);
|
|
66
102
|
for (const box of boundingBoxes) {
|
|
67
103
|
detections.push({
|
|
68
104
|
label: 'motion',
|
|
@@ -76,30 +112,21 @@ export class CameraDetector {
|
|
|
76
112
|
}
|
|
77
113
|
await this.cameraDevice.updateState('motion', { detections: detections }, frame);
|
|
78
114
|
}
|
|
115
|
+
this.imageProcessor.resetState();
|
|
79
116
|
}
|
|
80
|
-
|
|
81
|
-
if (this.
|
|
82
|
-
this.
|
|
83
|
-
this.closed = true;
|
|
84
|
-
this.logger.log(`Stopping motion detection for camera ${this.cameraDevice.name}`);
|
|
85
|
-
this.cameraDevice.updateState('motion', {
|
|
86
|
-
state: false,
|
|
87
|
-
detections: [],
|
|
88
|
-
});
|
|
117
|
+
defaultSettings() {
|
|
118
|
+
if (this.cameraStorage.values.area !== DEFAULT_MOTION_AREA) {
|
|
119
|
+
this.cameraStorage.setValue('area', DEFAULT_MOTION_AREA);
|
|
89
120
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (this.restarting) {
|
|
93
|
-
return;
|
|
121
|
+
if (this.cameraStorage.values.threshold !== DEFAULT_THRESHOLD) {
|
|
122
|
+
this.cameraStorage.setValue('threshold', DEFAULT_THRESHOLD);
|
|
94
123
|
}
|
|
95
|
-
this.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
await this.start();
|
|
124
|
+
if (this.cameraStorage.values.blurRadius !== DEFAULT_BLUR_RADIUS) {
|
|
125
|
+
this.cameraStorage.setValue('blurRadius', DEFAULT_BLUR_RADIUS);
|
|
126
|
+
}
|
|
127
|
+
if (this.cameraStorage.values.dilationSize !== DEFAULT_DILATION_SIZE) {
|
|
128
|
+
this.cameraStorage.setValue('dilationSize', DEFAULT_DILATION_SIZE);
|
|
101
129
|
}
|
|
102
|
-
this.restarting = false;
|
|
103
130
|
}
|
|
104
131
|
createCameraStorage() {
|
|
105
132
|
const cameraStorage = this.api.storageController.createCameraStorage(this, this.cameraDevice.id, {
|
|
@@ -115,8 +142,7 @@ export class CameraDetector {
|
|
|
115
142
|
step: 1,
|
|
116
143
|
required: true,
|
|
117
144
|
onSet: async (newValue, oldValue) => {
|
|
118
|
-
this.
|
|
119
|
-
this.restart();
|
|
145
|
+
this.cameraLogger.log(this.cameraDevice.name, `Motion area changed from ${oldValue} to ${newValue}`);
|
|
120
146
|
},
|
|
121
147
|
},
|
|
122
148
|
threshold: {
|
|
@@ -131,8 +157,7 @@ export class CameraDetector {
|
|
|
131
157
|
step: 1,
|
|
132
158
|
required: true,
|
|
133
159
|
onSet: async (newValue, oldValue) => {
|
|
134
|
-
this.
|
|
135
|
-
this.restart();
|
|
160
|
+
this.cameraLogger.log(this.cameraDevice.name, `Motion threshold changed from ${oldValue} to ${newValue}`);
|
|
136
161
|
},
|
|
137
162
|
},
|
|
138
163
|
blurRadius: {
|
|
@@ -147,8 +172,7 @@ export class CameraDetector {
|
|
|
147
172
|
step: 1,
|
|
148
173
|
required: true,
|
|
149
174
|
onSet: async (newValue, oldValue) => {
|
|
150
|
-
this.
|
|
151
|
-
this.restart();
|
|
175
|
+
this.cameraLogger.log(this.cameraDevice.name, `Motion blur radius changed from ${oldValue} to ${newValue}`);
|
|
152
176
|
},
|
|
153
177
|
},
|
|
154
178
|
dilationSize: {
|
|
@@ -163,8 +187,16 @@ export class CameraDetector {
|
|
|
163
187
|
step: 1,
|
|
164
188
|
required: true,
|
|
165
189
|
onSet: async (newValue, oldValue) => {
|
|
166
|
-
this.
|
|
167
|
-
|
|
190
|
+
this.cameraLogger.log(this.cameraDevice.name, `Motion dilation size changed from ${oldValue} to ${newValue}`);
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
reset: {
|
|
194
|
+
type: 'button',
|
|
195
|
+
title: 'Default Settings',
|
|
196
|
+
key: 'default',
|
|
197
|
+
description: 'Reset motion detection settings to default',
|
|
198
|
+
onSet: async () => {
|
|
199
|
+
this.defaultSettings();
|
|
168
200
|
},
|
|
169
201
|
},
|
|
170
202
|
});
|
package/dist/detector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.js","sourceRoot":"","sources":["../src/detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"detector.js","sourceRoot":"","sources":["../src/detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACnH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAA4B,MAAM,YAAY,CAAC;AAEtD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAEzB,MAAM,OAAO,cAAc;IAClB,aAAa,CAAqC;IAEjD,GAAG,CAAY;IACf,YAAY,CAAe;IAC3B,YAAY,CAAgB;IAE5B,OAAO,GAAG,KAAK,CAAC;IAChB,MAAM,GAAG,KAAK,CAAC;IACf,UAAU,GAAG,KAAK,CAAC;IAEnB,cAAc,CAAkB;IAExC,YAAY,YAA0B,EAAE,GAAc;QACpD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC;QAExC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,oDAAoD,OAAO,CAAC,QAAQ,WAAW,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAC/I,OAAO;QACT,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAEjD,IAAI,CAAC,YAAY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AI,EAAE,CAAC;gBACP,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,KAAK,EAAE,QAAgB,EAAE,QAAgB,EAAE,EAAE;oBAClD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,qCAAqC,QAAQ,OAAO,QAAQ,EAAE,CAAC,CAAC;gBAChH,CAAC;aACF;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,kBAAkB;gBACzB,GAAG,EAAE,SAAS;gBACd,WAAW,EAAE,4CAA4C;gBACzD,KAAK,EAAE,KAAK,IAAI,EAAE;oBAChB,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,CAAC;aACF;SACF,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -32,21 +32,21 @@ export default class RUSTMotion {
|
|
|
32
32
|
}
|
|
33
33
|
this.detectors.clear();
|
|
34
34
|
}
|
|
35
|
-
cameraSelected(camera
|
|
36
|
-
this.logger.log(`Camera added
|
|
35
|
+
cameraSelected(camera) {
|
|
36
|
+
this.logger.log(`Camera added: ${camera.name}`);
|
|
37
37
|
this.cameras.set(camera.id, camera);
|
|
38
38
|
this.createDetector(camera);
|
|
39
39
|
}
|
|
40
|
-
cameraDeselected(cameraId
|
|
40
|
+
cameraDeselected(cameraId) {
|
|
41
41
|
const camera = this.cameras.get(cameraId);
|
|
42
42
|
if (camera) {
|
|
43
|
-
this.logger.log(`Camera removed
|
|
43
|
+
this.logger.log(`Camera removed: ${camera.name}`);
|
|
44
44
|
this.removeDetector(cameraId);
|
|
45
45
|
this.cameras.delete(cameraId);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
createDetector(cameraDevice) {
|
|
49
|
-
const detector = new CameraDetector(cameraDevice, this.api
|
|
49
|
+
const detector = new CameraDetector(cameraDevice, this.api);
|
|
50
50
|
this.detectors.set(cameraDevice.id, detector);
|
|
51
51
|
}
|
|
52
52
|
removeDetector(cameraId) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C,MAAM,CAAC,OAAO,OAAO,UAAU;IACtB,MAAM,CAAgB;IACtB,GAAG,CAAY;IAEd,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC1C,SAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;IAEtD,YAAY,MAAqB,EAAE,GAAc;QAC/C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE9C,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClF,CAAC;IAEM,gBAAgB,CAAC,OAAuB;QAC7C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,6DAA6D;IACtD,KAAK,CAAC,YAAY,CAAC,QAAgB,EAA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AEO,gBAAgB,CAAC,QAAgB;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE1C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAClD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,YAA0B;QAC/C,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAEO,cAAc,CAAC,QAAgB;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE9C,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,6 +5,14 @@ export interface CameraStorageValues {
|
|
|
5
5
|
blurRadius: number;
|
|
6
6
|
dilationSize: number;
|
|
7
7
|
}
|
|
8
|
+
export declare class ImageProcessor {
|
|
9
|
+
previousBlurredImage?: Uint8Array;
|
|
10
|
+
constructor();
|
|
11
|
+
processImage(frame: Uint8Array, width: number, height: number, threshold: number, blurRadius: number, dilateSize: number, minArea: number): BoundingBox[];
|
|
12
|
+
resetState(): void;
|
|
13
|
+
}
|
|
8
14
|
export interface Addon {
|
|
9
|
-
|
|
15
|
+
ImageProcessor: {
|
|
16
|
+
new (): ImageProcessor;
|
|
17
|
+
};
|
|
10
18
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = dirname(__filename);
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const ADDON_NAME = 'rust_detector';
|
|
8
|
+
export const decoderPath = () => {
|
|
9
|
+
const platform = process.platform;
|
|
10
|
+
const arch = process.arch;
|
|
11
|
+
let targetDir;
|
|
12
|
+
switch (platform) {
|
|
13
|
+
case 'darwin':
|
|
14
|
+
targetDir = `${ADDON_NAME}_macos`;
|
|
15
|
+
break;
|
|
16
|
+
case 'win32':
|
|
17
|
+
if (arch === 'x64') {
|
|
18
|
+
targetDir = `${ADDON_NAME}_windows_x64`;
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
case 'linux':
|
|
22
|
+
if (arch === 'x64') {
|
|
23
|
+
targetDir = `${ADDON_NAME}_linux_x64`;
|
|
24
|
+
}
|
|
25
|
+
else if (arch === 'arm64') {
|
|
26
|
+
targetDir = `${ADDON_NAME}_linux_arm64`;
|
|
27
|
+
}
|
|
28
|
+
else if (arch === 'riscv64') {
|
|
29
|
+
targetDir = `${ADDON_NAME}_linux_riscv64`;
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
case 'freebsd':
|
|
33
|
+
if (arch === 'x64') {
|
|
34
|
+
targetDir = `${ADDON_NAME}_freebsd`;
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
if (!targetDir) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
return join(__dirname, '../../binary', targetDir, 'detector.node');
|
|
42
|
+
};
|
|
43
|
+
let addon;
|
|
44
|
+
export const getAddon = () => {
|
|
45
|
+
if (!addon) {
|
|
46
|
+
const addonPath = decoderPath();
|
|
47
|
+
if (!addonPath) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
addon = require(addonPath);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
//
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return addon;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=addon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon.js","sourceRoot":"","sources":["../../src/utils/addon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,UAAU,GAAG,eAAe,CAAC;AAEnC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAuB,EAAE;IAClD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1B,IAAI,SAA6B,CAAC;IAElC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,SAAS,GAAG,GAAG,UAAU,QAAQ,CAAC;YAClC,MAAM;QACR,KAAK,OAAO;YACV,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;gBACnB,SAAS,GAAG,GAAG,UAAU,cAAc,CAAC;YAC1C,CAAC;YACD,MAAM;QACR,KAAK,OAAO;YACV,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;gBACnB,SAAS,GAAG,GAAG,UAAU,YAAY,CAAC;YACxC,CAAC;iBAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC5B,SAAS,GAAG,GAAG,UAAU,cAAc,CAAC;YAC1C,CAAC;iBAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC9B,SAAS,GAAG,GAAG,UAAU,gBAAgB,CAAC;YAC5C,CAAC;YACD,MAAM;QACR,KAAK,SAAS;YACZ,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;gBACnB,SAAS,GAAG,GAAG,UAAU,UAAU,CAAC;YACtC,CAAC;YACD,MAAM;IACV,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,IAAI,KAAY,CAAC;AAEjB,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAsB,EAAE;IAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,SAAS,GAAG,WAAW,EAAE,CAAC;QAEhC,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,KAAK,GAAG,OAAO,CAAC,SAAS,CAAU,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,EAAE;QACJ,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,45 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "RUST Motion",
|
|
3
3
|
"name": "@camera.ui/camera-ui-rust-motion",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.15",
|
|
5
5
|
"description": "camera.ui rust motion detection plugin",
|
|
6
6
|
"author": "seydx (https://github.com/seydx/camera.ui)",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"cross-build": "cross build --message-format=json-render-diagnostics > cross.log",
|
|
13
|
-
"postcargo-build": "neon dist < cargo.log -n rust-detector",
|
|
14
|
-
"postcross-build": "neon dist -m /target < cross.log -n rust-detector",
|
|
15
|
-
"debug": "npm run cargo-build --",
|
|
16
|
-
"cross": "npm run cross-build -- --release",
|
|
17
|
-
"build": "rimraf dist && mkdir dist && npm run build:macos && tsc",
|
|
18
|
-
"build:all": "npm run build:macos && npm run build:windows && npm run build:linux-x64 && npm run build:linux-arm64 && npm run build:linux-arm && npm run build:riscv64 && npm run build:freebsd",
|
|
10
|
+
"build": "rimraf dist && tsc",
|
|
11
|
+
"build:rust": "napi build --release",
|
|
19
12
|
"build:macos": "npm run build:macos-arm64 && npm run build:macos-x64 && npm run build:macos-universal",
|
|
20
|
-
"build:macos-arm64": "RUSTFLAGS='-C target-feature=+neon' npm run
|
|
21
|
-
"build:macos-x64": "npm run
|
|
22
|
-
"build:macos-universal": "lipo -create -output
|
|
23
|
-
"build:windows-x64": "RUSTFLAGS
|
|
24
|
-
"build:linux-x64": "RUSTFLAGS='-C target-feature=+avx2,+sse4.1'
|
|
25
|
-
"build:
|
|
26
|
-
"build:
|
|
27
|
-
"build:
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"update": "updates --update ./",
|
|
13
|
+
"build:macos-arm64": "cross-env RUSTFLAGS='-C target-feature=+neon' npm run build:rust -- --target aarch64-apple-darwin && mv detector.node rust_detector_macos_arm64.node",
|
|
14
|
+
"build:macos-x64": "cross-env RUSTFLAGS='-C target-feature=+avx2,+sse4.1' npm run build:rust -- --target x86_64-apple-darwin && mv detector.node rust_detector_macos_x64.node",
|
|
15
|
+
"build:macos-universal": "lipo -create -output detector.node rust_detector_macos_arm64.node rust_detector_macos_x64.node",
|
|
16
|
+
"build:windows-x64": "cross-env RUSTFLAGS=\"-C target-feature=+avx2,+sse4.1\" npm run build:rust -- --target x86_64-pc-windows-msvc",
|
|
17
|
+
"build:linux-x64": "cross-env RUSTFLAGS='-C target-feature=+avx2,+sse4.1' npm run build:rust -- --target x86_64-unknown-linux-gnu",
|
|
18
|
+
"build:riscv64": "CROSS_CONTAINER_OPTS=--platform=linux/amd64 cross +nightly build --message-format=json-render-diagnostics > cross.log --target riscv64gc-unknown-linux-gnu --release && npm run build:rust",
|
|
19
|
+
"build:freebsd": "cross-env RUSTFLAGS='-C target-feature=+avx2,+sse4.1' CROSS_CONTAINER_OPTS=--platform=linux/amd64 cross +nightly build --message-format=json-render-diagnostics > cross.log --target x86_64-unknown-freebsd --release && npm run build:rust",
|
|
20
|
+
"build:linux-arm64": "cross-env RUSTFLAGS='-C target-feature=+neon' CROSS_CONTAINER_OPTS=--platform=linux/amd64 cross +nightly build --message-format=json-render-diagnostics > cross.log --target aarch64-unknown-linux-gnu --release && npm run build:rust",
|
|
21
|
+
"clean": "cargo clean && rimraf --glob *.node",
|
|
22
|
+
"clean:cargo": "cargo clean",
|
|
23
|
+
"format": "prettier --write 'src/' --ignore-unknown --no-error-on-unmatched-pattern && cargo fmt",
|
|
32
24
|
"install-updates": "npm i --save",
|
|
33
|
-
"prepublishOnly": "npm i --package-lock-only && npm run lint && npm run format && npm run build"
|
|
25
|
+
"prepublishOnly": "npm i --package-lock-only && npm run lint && npm run format && npm run build",
|
|
26
|
+
"lint": "eslint --fix --ext .js,.ts . && cargo clippy",
|
|
27
|
+
"update": "updates --update ./"
|
|
34
28
|
},
|
|
35
29
|
"devDependencies": {
|
|
36
|
-
"@camera.ui/types": "^0.0.
|
|
37
|
-
"@
|
|
30
|
+
"@camera.ui/types": "^0.0.77",
|
|
31
|
+
"@napi-rs/cli": "^2.18.4",
|
|
38
32
|
"@rushstack/eslint-patch": "^1.10.4",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
40
|
-
"@typescript-eslint/parser": "^8.
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.10.0",
|
|
34
|
+
"@typescript-eslint/parser": "^8.10.0",
|
|
41
35
|
"concurrently": "^9.0.1",
|
|
42
36
|
"copyfiles": "^2.4.1",
|
|
37
|
+
"cross-env": "^7.0.3",
|
|
43
38
|
"eslint": "8.57.0",
|
|
44
39
|
"eslint-config-prettier": "^9.1.0",
|
|
45
40
|
"eslint-plugin-prettier": "^5.2.1",
|
|
@@ -47,14 +42,14 @@
|
|
|
47
42
|
"rimraf": "^6.0.1",
|
|
48
43
|
"set-interval-async": "^3.0.3",
|
|
49
44
|
"sharp": "^0.33.5",
|
|
50
|
-
"typescript": "^5.6.
|
|
45
|
+
"typescript": "^5.6.3",
|
|
51
46
|
"updates": "^16.4.0"
|
|
52
47
|
},
|
|
53
48
|
"bugs": {
|
|
54
49
|
"url": "https://github.com/seydx/camera.ui/issues"
|
|
55
50
|
},
|
|
56
51
|
"engines": {
|
|
57
|
-
"camera.ui": ">=0.0.34-alpha.
|
|
52
|
+
"camera.ui": ">=0.0.34-alpha.2",
|
|
58
53
|
"node": ">=20.17.0"
|
|
59
54
|
},
|
|
60
55
|
"homepage": "https://github.com/seydx/camera.ui#readme",
|
|
@@ -69,8 +64,26 @@
|
|
|
69
64
|
"type": "git",
|
|
70
65
|
"url": "git+https://github.com/seydx/camera.ui.git"
|
|
71
66
|
},
|
|
67
|
+
"napi": {
|
|
68
|
+
"name": "detector",
|
|
69
|
+
"triples": {
|
|
70
|
+
"additional": [
|
|
71
|
+
"aarch64-apple-darwin",
|
|
72
|
+
"x86_64-apple-darwin",
|
|
73
|
+
"universal-apple-darwin",
|
|
74
|
+
"x86_64-pc-windows-msvc",
|
|
75
|
+
"x86_64-unknown-linux-gnu",
|
|
76
|
+
"aarch64-unknown-linux-gnu",
|
|
77
|
+
"x86_64-unknown-freebsd",
|
|
78
|
+
"riscv64gc-unknown-linux-gnu"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
72
82
|
"camera.ui": {
|
|
73
83
|
"extension": "motionDetection",
|
|
74
|
-
"dependencies": []
|
|
84
|
+
"dependencies": [],
|
|
85
|
+
"options": {
|
|
86
|
+
"extendedMotionDetection": true
|
|
87
|
+
}
|
|
75
88
|
}
|
|
76
89
|
}
|
|
Binary file
|