You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@camera.ui/camera-ui-pamdiff

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@camera.ui/camera-ui-pamdiff - npm Package Compare versions

Comparing version

to
0.0.12

79

dist/camera.js

@@ -86,40 +86,47 @@ import PamDiff from 'pam-diff';

let zeroDetections = 0;
for await (const frame of this.cameraDevice.getFrames()) {
if (!isActive) {
break;
}
const { image, info } = await frame.toBuffer({ format: { to: 'gray' } });
const header = ['P7', `WIDTH ${info.width}`, `HEIGHT ${info.height}`, 'DEPTH 1', 'MAXVAL 255', 'TUPLTYPE GRAYSCALE', 'ENDHDR'].join('\n') + '\n';
pt.write(Buffer.from(header));
pt.write(image);
await sleep(1);
const detections = [];
while (blobs.length > 1) {
const blob = blobs.shift();
if (blob) {
detections.push({
label: 'motion',
confidence: 1,
boundingBox: [blob.minX, blob.minY, blob.maxX, blob.maxY],
inputWidth: info.width,
inputHeight: info.height,
origWidth: frame.metadata.width,
origHeight: frame.metadata.height,
});
const motionDetection = async () => {
for await (const frame of this.cameraDevice.getFrames()) {
if (!isActive) {
break;
}
const { image, info } = await frame.toBuffer({ format: { to: 'gray' } });
const header = ['P7', `WIDTH ${info.width}`, `HEIGHT ${info.height}`, 'DEPTH 1', 'MAXVAL 255', 'TUPLTYPE GRAYSCALE', 'ENDHDR'].join('\n') + '\n';
pt.write(Buffer.from(header));
pt.write(image);
await sleep(1);
const detections = [];
while (blobs.length > 1) {
const blob = blobs.shift();
if (blob) {
detections.push({
label: 'motion',
confidence: 1,
boundingBox: [blob.minX, blob.minY, blob.maxX, blob.maxY],
inputWidth: info.width,
inputHeight: info.height,
origWidth: frame.metadata.width,
origHeight: frame.metadata.height,
});
}
}
if (!detections.length) {
zeroDetections++;
}
else {
zeroDetections = 0;
}
if (zeroDetections > 10) {
zeroDetections = 0;
await this.cameraDevice.updateState('motion', { detections }, frame);
}
else if (!zeroDetections) {
await this.cameraDevice.updateState('motion', { detections }, frame);
}
}
if (!detections.length) {
zeroDetections++;
}
else {
zeroDetections = 0;
}
if (zeroDetections > 10) {
zeroDetections = 0;
await this.cameraDevice.updateState('motion', { detections }, frame);
}
else if (!zeroDetections) {
await this.cameraDevice.updateState('motion', { detections }, frame);
}
}
};
motionDetection().catch((error) => {
this.logger.error(this.cameraDevice.name, 'An error occured during motion detection!', error);
kill();
this.restart();
});
return {

@@ -126,0 +133,0 @@ isActive() {

{
"displayName": "Pam Diff",
"name": "@camera.ui/camera-ui-pamdiff",
"version": "0.0.11",
"version": "0.0.12",
"description": "camera.ui pam diff plugin",

@@ -24,3 +24,3 @@ "author": "seydx (https://github.com/seydx/camera.ui)",

"@rushstack/eslint-patch": "^1.10.4",
"@types/node": "^22.4.1",
"@types/node": "^22.4.2",
"@types/ws": "^8.5.12",

@@ -27,0 +27,0 @@ "@typescript-eslint/eslint-plugin": "^8.2.0",

Sorry, the diff of this file is not supported yet