@blueharford/scrypted-spatial-awareness 0.4.7 → 0.4.8-beta.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 +62 -0
- package/dist/main.nodejs.js +1 -1
- package/dist/main.nodejs.js.map +1 -1
- package/dist/plugin.zip +0 -0
- package/out/main.nodejs.js +554 -137
- package/out/main.nodejs.js.map +1 -1
- package/out/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/core/object-correlator.ts +32 -7
- package/src/core/spatial-reasoning.ts +315 -44
- package/src/core/tracking-engine.ts +57 -19
- package/src/models/alert.ts +41 -14
package/src/models/alert.ts
CHANGED
|
@@ -214,26 +214,53 @@ export function generateAlertMessage(
|
|
|
214
214
|
|
|
215
215
|
switch (type) {
|
|
216
216
|
case 'property_entry':
|
|
217
|
-
|
|
217
|
+
// Use the rich description from spatial reasoning if available
|
|
218
|
+
if (details.objectLabel && details.objectLabel !== details.objectClass) {
|
|
219
|
+
return details.objectLabel;
|
|
220
|
+
}
|
|
221
|
+
// Fallback to basic description
|
|
222
|
+
if (details.involvedLandmarks && details.involvedLandmarks.length > 0) {
|
|
223
|
+
return `${objectDesc} entered property near ${details.involvedLandmarks[0]}`;
|
|
224
|
+
}
|
|
225
|
+
return `${objectDesc} entered property at ${details.cameraName || 'entrance'}`;
|
|
218
226
|
case 'property_exit':
|
|
219
|
-
|
|
227
|
+
// Use the rich description from spatial reasoning if available
|
|
228
|
+
if (details.objectLabel && details.objectLabel !== details.objectClass) {
|
|
229
|
+
return details.objectLabel;
|
|
230
|
+
}
|
|
231
|
+
// Fallback to basic description
|
|
232
|
+
if (details.involvedLandmarks && details.involvedLandmarks.length > 0) {
|
|
233
|
+
return `${objectDesc} left property via ${details.involvedLandmarks[0]}`;
|
|
234
|
+
}
|
|
235
|
+
return `${objectDesc} left property`;
|
|
220
236
|
case 'movement':
|
|
221
|
-
// If
|
|
222
|
-
if (details.objectLabel && details.
|
|
237
|
+
// If objectLabel contains a full description, use it directly
|
|
238
|
+
if (details.objectLabel && details.objectLabel !== details.objectClass) {
|
|
239
|
+
// Check if this is a cross-camera movement or initial detection
|
|
240
|
+
if (details.fromCameraId && details.fromCameraId !== details.toCameraId && details.transitTime) {
|
|
241
|
+
const transitSecs = Math.round(details.transitTime / 1000);
|
|
242
|
+
const transitStr = transitSecs > 0 ? ` (${transitSecs}s)` : '';
|
|
243
|
+
const pathContext = details.pathDescription ? ` via ${details.pathDescription}` : '';
|
|
244
|
+
return `${details.objectLabel}${pathContext}${transitStr}`;
|
|
245
|
+
}
|
|
246
|
+
// Initial detection - use the label directly
|
|
247
|
+
return details.objectLabel;
|
|
248
|
+
}
|
|
249
|
+
// Cross-camera movement with basic info
|
|
250
|
+
if (details.fromCameraId && details.fromCameraId !== details.toCameraId) {
|
|
223
251
|
const transitSecs = details.transitTime ? Math.round(details.transitTime / 1000) : 0;
|
|
224
|
-
const transitStr = transitSecs > 0 ? ` (${transitSecs}s)` : '';
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
252
|
+
const transitStr = transitSecs > 0 ? ` (${transitSecs}s transit)` : '';
|
|
253
|
+
let movementDesc = `${objectDesc} moving from ${details.fromCameraName || 'unknown'} towards ${details.toCameraName || 'unknown'}`;
|
|
254
|
+
if (details.involvedLandmarks && details.involvedLandmarks.length > 0) {
|
|
255
|
+
movementDesc += ` near ${details.involvedLandmarks.join(', ')}`;
|
|
256
|
+
}
|
|
257
|
+
return `${movementDesc}${transitStr}`;
|
|
228
258
|
}
|
|
229
|
-
//
|
|
230
|
-
const transitSecs = details.transitTime ? Math.round(details.transitTime / 1000) : 0;
|
|
231
|
-
const transitStr = transitSecs > 0 ? ` (${transitSecs}s transit)` : '';
|
|
232
|
-
let movementDesc = `${objectDesc} moving from ${details.fromCameraName || 'unknown'} towards ${details.toCameraName || 'unknown'}`;
|
|
259
|
+
// Initial detection without full label
|
|
233
260
|
if (details.involvedLandmarks && details.involvedLandmarks.length > 0) {
|
|
234
|
-
|
|
261
|
+
return `${objectDesc} detected near ${details.involvedLandmarks[0]}`;
|
|
235
262
|
}
|
|
236
|
-
return `${
|
|
263
|
+
return `${objectDesc} detected at ${details.cameraName || 'camera'}`;
|
|
237
264
|
case 'unusual_path':
|
|
238
265
|
return `${objectDesc} took unusual path: ${details.actualPath || 'unknown'}`;
|
|
239
266
|
case 'dwell_time':
|