2026-02-27 09:55:36 -06:00
|
|
|
import type { SectionConfigOverrides } from "./types";
|
|
|
|
|
|
|
|
|
|
const detect: SectionConfigOverrides = {
|
|
|
|
|
base: {
|
|
|
|
|
sectionDocs: "/configuration/camera_specific",
|
2026-05-07 13:23:02 -05:00
|
|
|
messages: [
|
|
|
|
|
{
|
|
|
|
|
key: "detect-disabled",
|
|
|
|
|
messageKey: "configMessages.detect.disabled",
|
|
|
|
|
severity: "info",
|
|
|
|
|
condition: (ctx) =>
|
|
|
|
|
ctx.level === "camera" && ctx.formData?.enabled === false,
|
|
|
|
|
},
|
2026-05-22 14:41:07 -05:00
|
|
|
{
|
|
|
|
|
key: "detect-resolution-not-multiple-of-four",
|
|
|
|
|
messageKey: "configMessages.detect.resolutionShouldBeMultipleOfFour",
|
|
|
|
|
severity: "warning",
|
|
|
|
|
condition: (ctx) => {
|
|
|
|
|
const width = ctx.formData?.width as number | null | undefined;
|
|
|
|
|
const height = ctx.formData?.height as number | null | undefined;
|
|
|
|
|
const isEvenButNotFour = (v: unknown) =>
|
|
|
|
|
typeof v === "number" && v % 2 === 0 && v % 4 !== 0;
|
|
|
|
|
return isEvenButNotFour(width) || isEvenButNotFour(height);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "detect-aspect-ratio-mismatch",
|
|
|
|
|
messageKey: "configMessages.detect.aspectRatioMismatch",
|
|
|
|
|
severity: "warning",
|
|
|
|
|
condition: (ctx) => {
|
|
|
|
|
const newWidth = ctx.formData?.width as number | null | undefined;
|
|
|
|
|
const newHeight = ctx.formData?.height as number | null | undefined;
|
|
|
|
|
if (typeof newWidth !== "number" || typeof newHeight !== "number") {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const saved =
|
|
|
|
|
ctx.level === "camera"
|
|
|
|
|
? ctx.fullCameraConfig?.detect
|
|
|
|
|
: ctx.fullConfig?.detect;
|
|
|
|
|
const savedWidth = saved?.width;
|
|
|
|
|
const savedHeight = saved?.height;
|
|
|
|
|
if (
|
|
|
|
|
typeof savedWidth !== "number" ||
|
|
|
|
|
typeof savedHeight !== "number" ||
|
|
|
|
|
savedWidth <= 0 ||
|
|
|
|
|
savedHeight <= 0
|
|
|
|
|
) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (newWidth === savedWidth && newHeight === savedHeight) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const newRatio = newWidth / newHeight;
|
|
|
|
|
const savedRatio = savedWidth / savedHeight;
|
|
|
|
|
return Math.abs(newRatio - savedRatio) > 0.01;
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-05-07 13:23:02 -05:00
|
|
|
],
|
2026-03-29 16:25:40 -05:00
|
|
|
fieldMessages: [
|
|
|
|
|
{
|
|
|
|
|
key: "fps-greater-than-five",
|
|
|
|
|
field: "fps",
|
|
|
|
|
messageKey: "configMessages.detect.fpsGreaterThanFive",
|
|
|
|
|
severity: "info",
|
|
|
|
|
position: "after",
|
|
|
|
|
condition: (ctx) => {
|
|
|
|
|
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
|
2026-05-06 11:01:50 -05:00
|
|
|
if (ctx.fullCameraConfig.type === "lpr") return false;
|
2026-03-29 16:25:40 -05:00
|
|
|
const detectFps = ctx.formData?.fps as number | undefined;
|
|
|
|
|
const streamFps = ctx.fullCameraConfig.detect?.fps;
|
|
|
|
|
return detectFps != null && streamFps != null && detectFps > 5;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
2026-02-27 09:55:36 -06:00
|
|
|
fieldOrder: [
|
|
|
|
|
"enabled",
|
|
|
|
|
"width",
|
|
|
|
|
"height",
|
|
|
|
|
"fps",
|
|
|
|
|
"min_initialized",
|
|
|
|
|
"max_disappeared",
|
|
|
|
|
"annotation_offset",
|
|
|
|
|
"stationary",
|
|
|
|
|
"interval",
|
|
|
|
|
"threshold",
|
|
|
|
|
"max_frames",
|
|
|
|
|
],
|
|
|
|
|
restartRequired: [],
|
|
|
|
|
fieldGroups: {
|
2026-03-20 08:24:34 -05:00
|
|
|
resolution: ["width", "height", "fps"],
|
2026-02-27 09:55:36 -06:00
|
|
|
tracking: ["min_initialized", "max_disappeared"],
|
|
|
|
|
},
|
|
|
|
|
hiddenFields: ["enabled_in_config"],
|
|
|
|
|
advancedFields: [
|
|
|
|
|
"min_initialized",
|
|
|
|
|
"max_disappeared",
|
|
|
|
|
"annotation_offset",
|
|
|
|
|
"stationary",
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
global: {
|
2026-03-08 12:27:53 -05:00
|
|
|
restartRequired: [
|
|
|
|
|
"fps",
|
|
|
|
|
"width",
|
|
|
|
|
"height",
|
|
|
|
|
"min_initialized",
|
|
|
|
|
"max_disappeared",
|
|
|
|
|
],
|
2026-02-27 09:55:36 -06:00
|
|
|
},
|
|
|
|
|
camera: {
|
2026-03-08 12:27:53 -05:00
|
|
|
restartRequired: [
|
|
|
|
|
"fps",
|
|
|
|
|
"width",
|
|
|
|
|
"height",
|
|
|
|
|
"min_initialized",
|
|
|
|
|
"max_disappeared",
|
|
|
|
|
],
|
2026-02-27 09:55:36 -06:00
|
|
|
},
|
2026-05-22 09:39:52 -05:00
|
|
|
replay: {
|
|
|
|
|
restartRequired: [],
|
|
|
|
|
fieldOrder: ["width", "height", "fps"],
|
|
|
|
|
fieldGroups: {
|
|
|
|
|
resolution: ["width", "height", "fps"],
|
|
|
|
|
},
|
|
|
|
|
hiddenFields: [
|
|
|
|
|
"enabled",
|
|
|
|
|
"enabled_in_config",
|
|
|
|
|
"min_initialized",
|
|
|
|
|
"max_disappeared",
|
|
|
|
|
"annotation_offset",
|
|
|
|
|
"stationary",
|
|
|
|
|
"interval",
|
|
|
|
|
"threshold",
|
|
|
|
|
"max_frames",
|
|
|
|
|
],
|
|
|
|
|
advancedFields: [],
|
|
|
|
|
},
|
2026-02-27 09:55:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default detect;
|