mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Show custom.png for birdseye icon if available
This commit is contained in:
parent
b1cc64d4fa
commit
4adc726ece
@ -22,6 +22,7 @@ from ws4py.server.wsgiutils import WebSocketWSGIApplication
|
|||||||
from ws4py.websocket import WebSocket
|
from ws4py.websocket import WebSocket
|
||||||
|
|
||||||
from frigate.config import BirdseyeModeEnum, FrigateConfig
|
from frigate.config import BirdseyeModeEnum, FrigateConfig
|
||||||
|
from frigate.const import BASE_DIR
|
||||||
from frigate.util import SharedMemoryFrameManager, copy_yuv_to_position, get_yuv_crop
|
from frigate.util import SharedMemoryFrameManager, copy_yuv_to_position, get_yuv_crop
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -104,12 +105,22 @@ class BirdsEyeFrameManager:
|
|||||||
self.blank_frame[0 : self.frame_shape[0], 0 : self.frame_shape[1]] = 16
|
self.blank_frame[0 : self.frame_shape[0], 0 : self.frame_shape[1]] = 16
|
||||||
|
|
||||||
# find and copy the logo on the blank frame
|
# find and copy the logo on the blank frame
|
||||||
|
birdseye_logo = None
|
||||||
|
|
||||||
|
if config.birdseye.use_custom_icon:
|
||||||
|
custom_logo_files = glob.glob(f"{BASE_DIR}/custom.png")
|
||||||
|
|
||||||
|
if len(custom_logo_files) > 0:
|
||||||
|
birdseye_logo = cv2.imread(custom_logo_files[0], cv2.IMREAD_UNCHANGED)
|
||||||
|
|
||||||
|
if birdseye_logo is None:
|
||||||
logo_files = glob.glob("/opt/frigate/frigate/birdseye.png")
|
logo_files = glob.glob("/opt/frigate/frigate/birdseye.png")
|
||||||
frigate_logo = None
|
|
||||||
if len(logo_files) > 0:
|
if len(logo_files) > 0:
|
||||||
frigate_logo = cv2.imread(logo_files[0], cv2.IMREAD_UNCHANGED)
|
birdseye_logo = cv2.imread(logo_files[0], cv2.IMREAD_UNCHANGED)
|
||||||
if not frigate_logo is None:
|
|
||||||
transparent_layer = frigate_logo[:, :, 3]
|
if not birdseye_logo is None:
|
||||||
|
transparent_layer = birdseye_logo[:, :, 3]
|
||||||
y_offset = height // 2 - transparent_layer.shape[0] // 2
|
y_offset = height // 2 - transparent_layer.shape[0] // 2
|
||||||
x_offset = width // 2 - transparent_layer.shape[1] // 2
|
x_offset = width // 2 - transparent_layer.shape[1] // 2
|
||||||
self.blank_frame[
|
self.blank_frame[
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user