Skip to content

Commit

Permalink
videoanalysis: add support for lpr on smart motion sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Apr 17, 2024
1 parent 3abb647 commit 1c8fd23
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions plugins/objectdetector/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/objectdetector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/objectdetector",
"version": "0.1.33",
"version": "0.1.34",
"description": "Scrypted Video Analysis Plugin. Installed alongside a detection service like OpenCV or TensorFlow.",
"author": "Scrypted",
"license": "Apache-2.0",
Expand Down
10 changes: 6 additions & 4 deletions plugins/objectdetector/src/smart-motionsensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ export class SmartMotionSensor extends ScryptedDeviceBase implements Settings, R
defaultValue: 0.7,
},
labels: {
group: 'Recognition',
title: 'Labels',
description: 'The labels that will trigger this smart motion sensor.',
description: 'The labels (license numbers, names) that will trigger this smart motion sensor.',
multiple: true,
combobox: true,
choices: [],
},
labelDistance: {
group: 'Recognition',
title: 'Label Distance',
description: 'The maximum edit distance between the detected label and the desired label. Ie, a distance of 1 will match "abcde" to "abcbe" or "abcd".',
type: 'number',
Expand Down Expand Up @@ -198,11 +200,10 @@ export class SmartMotionSensor extends ScryptedDeviceBase implements Settings, R
this.console.warn('Camera does not provide Zones in detection event. Zone filter will not be applied.');
}
}
if (d.movement && !d.movement.moving)
return false;

// when not searching for a label, validate the object is moving.
if (!labels?.length)
return true;
return !d.movement || d.movement.moving;

if (!d.label)
return false;
Expand All @@ -215,6 +216,7 @@ export class SmartMotionSensor extends ScryptedDeviceBase implements Settings, R
continue;
if (levenshteinDistance(label, du) <= labelDistance)
return true;
this.console.log('No label does not match.', label, du);
}

return false;
Expand Down

0 comments on commit 1c8fd23

Please sign in to comment.