mirror of
https://github.com/koush/scrypted.git
synced 2026-06-20 16:40:30 +01:00
videoanalysis: logging
This commit is contained in:
4
plugins/objectdetector/package-lock.json
generated
4
plugins/objectdetector/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/objectdetector",
|
||||
"version": "0.0.138",
|
||||
"version": "0.0.140",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/objectdetector",
|
||||
"version": "0.0.138",
|
||||
"version": "0.0.140",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/objectdetector",
|
||||
"version": "0.0.138",
|
||||
"version": "0.0.140",
|
||||
"description": "Scrypted Video Analysis Plugin. Installed alongside a detection service like OpenCV or TensorFlow.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -19,6 +19,7 @@ async function createRawImageMediaObject(image: RawImage): Promise<Image & Media
|
||||
height: image.height,
|
||||
toBuffer: (options: ImageOptions) => image.toBuffer(options),
|
||||
toImage: (options: ImageOptions) => image.toImage(options),
|
||||
close: () => image.close(),
|
||||
});
|
||||
|
||||
return ret;
|
||||
@@ -28,6 +29,10 @@ class RawImage implements Image, RawFrame {
|
||||
constructor(public data: Buffer, public width: number, public height: number, public format: ImageFormat) {
|
||||
}
|
||||
|
||||
async close(): Promise<void> {
|
||||
this.data = undefined;
|
||||
}
|
||||
|
||||
checkOptions(options: ImageOptions) {
|
||||
if (options?.resize || options?.crop)
|
||||
throw new Error('resize and crop are not supported');
|
||||
|
||||
@@ -37,6 +37,7 @@ async function createVipsMediaObject(image: VipsImage): Promise<Image & MediaObj
|
||||
const newImage = await image.toVipsImage(options);
|
||||
return createVipsMediaObject(newImage);
|
||||
},
|
||||
close: () => image.close(),
|
||||
});
|
||||
|
||||
return ret;
|
||||
@@ -52,6 +53,11 @@ class VipsImage implements Image {
|
||||
constructor(public image: sharp.Sharp, public width: number, public height: number, public channels: number) {
|
||||
}
|
||||
|
||||
async close(): Promise<void> {
|
||||
this.image?.destroy();
|
||||
this.image = undefined;
|
||||
}
|
||||
|
||||
toImageInternal(options: ImageOptions) {
|
||||
const transformed = this.image.clone();
|
||||
if (options?.crop) {
|
||||
|
||||
@@ -270,10 +270,13 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase<VideoCamera & Camera
|
||||
.catch(e => {
|
||||
this.console.error('Video Analysis ended with error', e);
|
||||
}).finally(() => {
|
||||
if (!this.hasMotionType)
|
||||
if (!this.hasMotionType) {
|
||||
this.plugin.objectDetectionEnded(this.console, options.snapshotPipeline);
|
||||
else
|
||||
this.console.log('Video Analysis object detection ended.');
|
||||
}
|
||||
else {
|
||||
this.console.log('Video Analysis motion detection ended.');
|
||||
}
|
||||
signal.resolve();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user