Skip to content

Using the substring "flip" in the text for freetype.putText duplicates the last character #2627

Open
@ichu-lsa

Description

@ichu-lsa
System information (version)
  • OpenCV => 4.2
  • Operating System / Platform => Ubuntu 18.04
  • Compiler => gcc
Detailed description

Having the substring "flip" anywhere in the text parameter for cv2.freetype.putText() causes the last character to be duplicated. Including it twice will cause the last two characters to be duplicated (i.e "xflipflipx" will cause "xflipflipxpx" to appear on screen).
This is a pretty low-priority bug since it doesn't seem to cause any additional problems and is just a graphical glitch, but it's definitely one of the weirdest ones I've come across with opencv.

Steps to reproduce
import cv2
import numpy as np

# load font
font = cv2.freetype.createFreeType2();
font.loadFontData("Font/JosefinSansBold-OVA7o.ttf", 0); # replace with whatever font

# make empty image
img = np.zeros((600,600,3), np.uint8);

# draw text
img = font.putText(img, "x flip y flip z", (50,50), 25, (255, 255, 255), -1, cv2.LINE_AA, True);

# show image
cv2.imshow("Image", img);
cv2.waitKey(0);
Edits

This seems to happen with the substring 'find' as well. There are probably more keywords that trigger this behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions