voxel51 / eta

ETA: Extensible Toolkit for Analytics
https://voxel51.com
Apache License 2.0
29 stars 13 forks source link

Release v0.12.3 #608

Closed brimoor closed 8 months ago

brimoor commented 8 months ago

A user pointed out that our default lato-regular font doesn't support unicode.

Switching to Arial resolves the issue.

import cv2
import fiftyone as fo
import numpy as np

cv2.imwrite("/tmp/sample.png", np.full((1024, 1024, 3), 255))

sample = fo.Sample(
    filepath="/tmp/sample.png",
    detections=fo.Detections(
        detections=[
            fo.Detection(label="Объект", bounding_box=[0.4, 0.4, 0.2, 0.2])
        ]
    ),
)

dataset = fo.Dataset()
dataset.add_sample(sample)

# Previous workaround: manually specify a unicode-friendly font
# dataset.draw_labels("/tmp/sample", font_path="Arial.ttf")

# Now this works by default
dataset.draw_labels("/tmp/draw-labels")

arial