@camera.ui/camera-ui-opencv 0.0.11 → 0.0.13
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/package.json +2 -2
- package/requirements.txt +1 -1
- package/src/camera_detector.py +2 -2
- package/src/main.py +6 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "OpenCV",
|
|
3
3
|
"name": "@camera.ui/camera-ui-opencv",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"description": "camera.ui opencv plugin",
|
|
6
6
|
"author": "seydx (https://github.com/seydx/camera.ui)",
|
|
7
7
|
"main": "./src/main.py",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://github.com/seydx/camera.ui/issues"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
|
-
"camera.ui": ">=0.0.
|
|
24
|
+
"camera.ui": ">=0.0.31-alpha.0",
|
|
25
25
|
"node": ">=18.12.0"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/seydx/camera.ui#readme",
|
package/requirements.txt
CHANGED
package/src/camera_detector.py
CHANGED
|
@@ -8,8 +8,8 @@ from camera_ui_python_types import (
|
|
|
8
8
|
CameraDevice,
|
|
9
9
|
CameraStorage,
|
|
10
10
|
Detection,
|
|
11
|
+
LoggerService,
|
|
11
12
|
PluginAPI,
|
|
12
|
-
PluginLogger,
|
|
13
13
|
)
|
|
14
14
|
from detector_defaults import (
|
|
15
15
|
available_models,
|
|
@@ -30,7 +30,7 @@ background_tasks = set[asyncio.Task[Any]]()
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class CameraDetector:
|
|
33
|
-
def __init__(self, api: PluginAPI, camera: CameraDevice, logger:
|
|
33
|
+
def __init__(self, api: PluginAPI, camera: CameraDevice, logger: LoggerService) -> None:
|
|
34
34
|
super().__init__()
|
|
35
35
|
|
|
36
36
|
self.api = api
|
package/src/main.py
CHANGED
|
@@ -10,10 +10,10 @@ from camera_ui_python_types import (
|
|
|
10
10
|
CameraDevice,
|
|
11
11
|
CameraExtension,
|
|
12
12
|
FormSubmitResponse,
|
|
13
|
+
LoggerService,
|
|
13
14
|
MotionDetectionPlugin,
|
|
14
15
|
MotionDetectionPluginResponse,
|
|
15
16
|
PluginAPI,
|
|
16
|
-
PluginLogger,
|
|
17
17
|
RootSchema,
|
|
18
18
|
)
|
|
19
19
|
from detector_defaults import (
|
|
@@ -31,7 +31,7 @@ from opencv_utils import get_detections, get_detections_bs, get_detections_fd
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class OpenCV(MotionDetectionPlugin):
|
|
34
|
-
def __init__(self, logger:
|
|
34
|
+
def __init__(self, logger: LoggerService, api: PluginAPI):
|
|
35
35
|
self.api = api
|
|
36
36
|
self.logger = logger
|
|
37
37
|
self.cameras: dict[str, CameraDevice] = {}
|
|
@@ -88,8 +88,8 @@ class OpenCV(MotionDetectionPlugin):
|
|
|
88
88
|
detector.close()
|
|
89
89
|
del self.detectors[camera.id]
|
|
90
90
|
|
|
91
|
-
def interfaceSchema(self) -> RootSchema
|
|
92
|
-
|
|
91
|
+
def interfaceSchema(self) -> RootSchema:
|
|
92
|
+
root_schema: RootSchema = {
|
|
93
93
|
"schema": {
|
|
94
94
|
"motion_detector": {
|
|
95
95
|
"type": "string",
|
|
@@ -233,6 +233,8 @@ class OpenCV(MotionDetectionPlugin):
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
return root_schema
|
|
237
|
+
|
|
236
238
|
async def detectMotion(self, video_path: str, config: dict[str, Any]) -> MotionDetectionPluginResponse:
|
|
237
239
|
with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as temp_file:
|
|
238
240
|
output_file = temp_file.name
|