mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Avoid drawing image_processing font text inside the bow line (#27796)
* Adjust font text such that it won't be drawn inside the bow line in image_processing.draw_box * Adjust font_height after actually counting the pixels * Thinned out line_width and adjusted font size
This commit is contained in:
parent
804b6bbc0e
commit
11efb2c2eb
@ -85,7 +85,8 @@ def draw_box(
|
|||||||
the bounding box will be `(40, 10)` to `(180, 50)` (in (x,y) coordinates).
|
the bounding box will be `(40, 10)` to `(180, 50)` (in (x,y) coordinates).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
line_width = 5
|
line_width = 3
|
||||||
|
font_height = 8
|
||||||
y_min, x_min, y_max, x_max = box
|
y_min, x_min, y_max, x_max = box
|
||||||
(left, right, top, bottom) = (
|
(left, right, top, bottom) = (
|
||||||
x_min * img_width,
|
x_min * img_width,
|
||||||
@ -99,7 +100,9 @@ def draw_box(
|
|||||||
fill=color,
|
fill=color,
|
||||||
)
|
)
|
||||||
if text:
|
if text:
|
||||||
draw.text((left + line_width, abs(top - line_width)), text, fill=color)
|
draw.text(
|
||||||
|
(left + line_width, abs(top - line_width - font_height)), text, fill=color
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass, config):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user