Skip to content

Implement putText() #1

@sfe-SparkFro

Description

@sfe-SparkFro

Was almost implemented in 2f9b0f7, however there were a couple issues, so it was commented out. The problems:

  • The firmware size exploded, from roughly 2.4MB to 4.8MB.
  • It a long time to execute.
  • The output did not match what was expected.

For example, running the following in normal OpenCV Python:

img = np.zeros((6,8), dtype=np.uint8)
cv2.putText(img, "H i", (0, 4), cv2.FONT_HERSHEY_SIMPLEX, 0.15, (255))

results in the following:

array([[  0,   0,   0,   0,   0,   0,   0,   0],
       [  0, 255,   0, 255,   0,   0, 255,   0],
       [  0, 255, 255, 255,   0,   0, 255,   0],
       [  0, 255,   0, 255,   0,   0, 255,   0],
       [  0, 255,   0, 255,   0,   0, 255,   0],
       [  0,   0,   0,   0,   0,   0,   0,   0]], dtype=uint8)

Running in MicroPython, it takes almost 4 seconds, and the output is different:

array([[0, 0, 0, 0, 7, 0, 0, 0],
       [105, 0, 105, 0, 63, 0, 0, 0],
       [128, 98, 132, 0, 101, 0, 0, 0],
       [106, 0, 106, 0, 100, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions