mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-08 13:51:01 +02:00
parent
1787f6130d
commit
e7c6b2d571
@ -1,7 +1,7 @@
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import ConfigDict, Field
|
||||||
|
|
||||||
from .base import FrigateBaseModel
|
from .base import FrigateBaseModel
|
||||||
|
|
||||||
@ -86,6 +86,8 @@ class CameraFaceRecognitionConfig(FrigateBaseModel):
|
|||||||
default=500, title="Min area of face box to consider running face recognition."
|
default=500, title="Min area of face box to consider running face recognition."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
model_config = ConfigDict(extra="ignore", protected_namespaces=())
|
||||||
|
|
||||||
|
|
||||||
class LicensePlateRecognitionConfig(FrigateBaseModel):
|
class LicensePlateRecognitionConfig(FrigateBaseModel):
|
||||||
enabled: bool = Field(default=False, title="Enable license plate recognition.")
|
enabled: bool = Field(default=False, title="Enable license plate recognition.")
|
||||||
@ -129,3 +131,5 @@ class CameraLicensePlateRecognitionConfig(FrigateBaseModel):
|
|||||||
default=1000,
|
default=1000,
|
||||||
title="Minimum area of license plate to begin running recognition.",
|
title="Minimum area of license plate to begin running recognition.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
model_config = ConfigDict(extra="ignore", protected_namespaces=())
|
||||||
|
@ -437,6 +437,8 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
include={
|
include={
|
||||||
"audio": ...,
|
"audio": ...,
|
||||||
"birdseye": ...,
|
"birdseye": ...,
|
||||||
|
"face_recognition": ...,
|
||||||
|
"lpr": ...,
|
||||||
"record": ...,
|
"record": ...,
|
||||||
"snapshots": ...,
|
"snapshots": ...,
|
||||||
"live": ...,
|
"live": ...,
|
||||||
|
@ -844,6 +844,8 @@ class LicensePlateProcessingMixin:
|
|||||||
|
|
||||||
def lpr_process(self, obj_data: dict[str, any], frame: np.ndarray):
|
def lpr_process(self, obj_data: dict[str, any], frame: np.ndarray):
|
||||||
"""Look for license plates in image."""
|
"""Look for license plates in image."""
|
||||||
|
if not self.config.cameras[obj_data["camera"]].lpr.enabled:
|
||||||
|
return
|
||||||
|
|
||||||
id = obj_data["id"]
|
id = obj_data["id"]
|
||||||
|
|
||||||
@ -910,7 +912,10 @@ class LicensePlateProcessingMixin:
|
|||||||
|
|
||||||
# check that license plate is valid
|
# check that license plate is valid
|
||||||
# double the value because we've doubled the size of the car
|
# double the value because we've doubled the size of the car
|
||||||
if license_plate_area < self.lpr_config.min_area * 2:
|
if (
|
||||||
|
license_plate_area
|
||||||
|
< self.config.cameras[obj_data["camera"]].lpr.min_area * 2
|
||||||
|
):
|
||||||
logger.debug("License plate is less than min_area")
|
logger.debug("License plate is less than min_area")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -942,7 +947,8 @@ class LicensePlateProcessingMixin:
|
|||||||
# check that license plate is valid
|
# check that license plate is valid
|
||||||
if (
|
if (
|
||||||
not license_plate_box
|
not license_plate_box
|
||||||
or area(license_plate_box) < self.lpr_config.min_area
|
or area(license_plate_box)
|
||||||
|
< self.config.cameras[obj_data["camera"]].lpr.min_area
|
||||||
):
|
):
|
||||||
logger.debug(f"Invalid license plate box {license_plate}")
|
logger.debug(f"Invalid license plate box {license_plate}")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user