re-crop to the object rather than the region

This commit is contained in:
Blake Blackshear
2020-12-19 08:48:34 -06:00
parent 899d41f361
commit af8594c5c6
2 changed files with 8 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ from peewee import SqliteDatabase, operator, fn, DoesNotExist
from playhouse.shortcuts import model_to_dict
from frigate.models import Event
from frigate.util import calculate_region
from frigate.version import VERSION
logger = logging.getLogger(__name__)
@@ -190,7 +191,8 @@ def best(camera_name, label):
crop = bool(request.args.get('crop', 0, type=int))
if crop:
region = best_object.get('region', [0,0,300,300])
box = best_object.get('box', (0,0,300,300))
region = calculate_region(best_frame.shape, box[0], box[1], box[2], box[3], 1.1)
best_frame = best_frame[region[1]:region[3], region[0]:region[2]]
height = int(request.args.get('h', str(best_frame.shape[0])))