@blueharford/scrypted-spatial-awareness 0.6.16 → 0.6.17
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/main.nodejs.js +1 -1
- package/dist/main.nodejs.js.map +1 -1
- package/dist/plugin.zip +0 -0
- package/out/main.nodejs.js +24 -1
- package/out/main.nodejs.js.map +1 -1
- package/out/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/core/topology-discovery.ts +16 -1
- package/src/ui/editor-html.ts +10 -0
package/out/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -379,13 +379,28 @@ export class TopologyDiscoveryEngine {
|
|
|
379
379
|
try {
|
|
380
380
|
this.console.log(`[Discovery] Trying ${formatType} image format for ${cameraName}...`);
|
|
381
381
|
|
|
382
|
+
// Build prompt with camera context (height)
|
|
383
|
+
const cameraNode = this.topology ? findCamera(this.topology, cameraId) : null;
|
|
384
|
+
const mountHeight = cameraNode?.context?.mountHeight || 8;
|
|
385
|
+
const cameraRange = (cameraNode?.fov as any)?.range || 80;
|
|
386
|
+
|
|
387
|
+
// Add camera-specific context to the prompt
|
|
388
|
+
const contextPrefix = `CAMERA INFORMATION:
|
|
389
|
+
- Camera Name: ${cameraName}
|
|
390
|
+
- Mount Height: ${mountHeight} feet above ground
|
|
391
|
+
- Approximate viewing range: ${cameraRange} feet
|
|
392
|
+
|
|
393
|
+
Use the mount height to help estimate distances - objects at ground level will appear at different angles depending on distance from a camera mounted at ${mountHeight} feet.
|
|
394
|
+
|
|
395
|
+
`;
|
|
396
|
+
|
|
382
397
|
// Build multimodal message with provider-specific image format
|
|
383
398
|
const result = await llm.getChatCompletion({
|
|
384
399
|
messages: [
|
|
385
400
|
{
|
|
386
401
|
role: 'user',
|
|
387
402
|
content: [
|
|
388
|
-
{ type: 'text', text: SCENE_ANALYSIS_PROMPT },
|
|
403
|
+
{ type: 'text', text: contextPrefix + SCENE_ANALYSIS_PROMPT },
|
|
389
404
|
buildImageContent(imageData, formatType),
|
|
390
405
|
],
|
|
391
406
|
},
|
package/src/ui/editor-html.ts
CHANGED
|
@@ -1632,8 +1632,12 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1632
1632
|
const fov = camera.fov || { mode: 'simple', angle: 90, direction: 0, range: 80 };
|
|
1633
1633
|
// Convert stored pixel range to feet for display
|
|
1634
1634
|
const rangeInFeet = Math.round(pixelsToFeet(fov.range || 80));
|
|
1635
|
+
// Get mount height from context or default to 8
|
|
1636
|
+
const mountHeight = camera.context?.mountHeight || 8;
|
|
1635
1637
|
panel.innerHTML = '<h3>Camera Properties</h3>' +
|
|
1636
1638
|
'<div class="form-group"><label>Name</label><input type="text" value="' + camera.name + '" onchange="updateCameraName(\\'' + camera.deviceId + '\\', this.value)"></div>' +
|
|
1639
|
+
'<div class="form-group"><label>Mount Height (feet)</label><input type="number" value="' + mountHeight + '" min="1" max="40" step="0.5" onchange="updateCameraMountHeight(\\'' + camera.deviceId + '\\', this.value)"></div>' +
|
|
1640
|
+
'<div style="font-size: 11px; color: #666; margin-top: -10px; margin-bottom: 10px;">Height affects distance estimation in discovery</div>' +
|
|
1637
1641
|
'<div class="form-group"><label class="checkbox-group"><input type="checkbox" ' + (camera.isEntryPoint ? 'checked' : '') + ' onchange="updateCameraEntry(\\'' + camera.deviceId + '\\', this.checked)">Entry Point</label></div>' +
|
|
1638
1642
|
'<div class="form-group"><label class="checkbox-group"><input type="checkbox" ' + (camera.isExitPoint ? 'checked' : '') + ' onchange="updateCameraExit(\\'' + camera.deviceId + '\\', this.checked)">Exit Point</label></div>' +
|
|
1639
1643
|
'<h4 style="margin-top: 15px; margin-bottom: 10px; color: #888;">Field of View</h4>' +
|
|
@@ -1652,6 +1656,12 @@ export const EDITOR_HTML = `<!DOCTYPE html>
|
|
|
1652
1656
|
function updateCameraName(id, value) { const camera = topology.cameras.find(c => c.deviceId === id); if (camera) camera.name = value; updateUI(); }
|
|
1653
1657
|
function updateCameraEntry(id, value) { const camera = topology.cameras.find(c => c.deviceId === id); if (camera) camera.isEntryPoint = value; }
|
|
1654
1658
|
function updateCameraExit(id, value) { const camera = topology.cameras.find(c => c.deviceId === id); if (camera) camera.isExitPoint = value; }
|
|
1659
|
+
function updateCameraMountHeight(id, value) {
|
|
1660
|
+
const camera = topology.cameras.find(c => c.deviceId === id);
|
|
1661
|
+
if (!camera) return;
|
|
1662
|
+
if (!camera.context) camera.context = {};
|
|
1663
|
+
camera.context.mountHeight = parseFloat(value) || 8;
|
|
1664
|
+
}
|
|
1655
1665
|
function updateCameraFov(id, field, value) {
|
|
1656
1666
|
const camera = topology.cameras.find(c => c.deviceId === id);
|
|
1657
1667
|
if (!camera) return;
|