mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-02 09:02:15 +03:00
Object area debugging and improvements (#16432)
* add ability to specify min and max area as percentages * debug draw area and ratio * docs * update for best percentage
This commit is contained in:
@@ -11,11 +11,13 @@ DEFAULT_TRACKED_OBJECTS = ["person"]
|
||||
|
||||
|
||||
class FilterConfig(FrigateBaseModel):
|
||||
min_area: int = Field(
|
||||
default=0, title="Minimum area of bounding box for object to be counted."
|
||||
min_area: Union[int, float] = Field(
|
||||
default=0,
|
||||
title="Minimum area of bounding box for object to be counted. Can be pixels (int) or percentage (float between 0.000001 and 0.99).",
|
||||
)
|
||||
max_area: int = Field(
|
||||
default=24000000, title="Maximum area of bounding box for object to be counted."
|
||||
max_area: Union[int, float] = Field(
|
||||
default=24000000,
|
||||
title="Maximum area of bounding box for object to be counted. Can be pixels (int) or percentage (float between 0.000001 and 0.99).",
|
||||
)
|
||||
min_ratio: float = Field(
|
||||
default=0,
|
||||
|
||||
@@ -29,6 +29,7 @@ from frigate.util.builtin import (
|
||||
)
|
||||
from frigate.util.config import (
|
||||
StreamInfoRetriever,
|
||||
convert_area_to_pixels,
|
||||
find_config_file,
|
||||
get_relative_coordinates,
|
||||
migrate_frigate_config,
|
||||
@@ -148,6 +149,13 @@ class RuntimeFilterConfig(FilterConfig):
|
||||
if mask is not None:
|
||||
config["mask"] = create_mask(frame_shape, mask)
|
||||
|
||||
# Convert min_area and max_area to pixels if they're percentages
|
||||
if "min_area" in config:
|
||||
config["min_area"] = convert_area_to_pixels(config["min_area"], frame_shape)
|
||||
|
||||
if "max_area" in config:
|
||||
config["max_area"] = convert_area_to_pixels(config["max_area"], frame_shape)
|
||||
|
||||
super().__init__(**config)
|
||||
|
||||
def dict(self, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user