1

I want to create a synthetic dataset for character recognition from images. I have a list of words or sequences as text data that I want to draw as images with different fonts and font sizes.

I am using PIL python library for drawing text on images. But the problem is, when the text is drawn in different font sizes, I got stuck to get the coordinates of individual character for drawing the bounding box. [![enter image description here][2]][2] Any idea, code chunk or suggestion of any convenient resource would be very helpful. enter image description here

Faruk Ahmad
  • 128
  • 10
  • Can you clarify what you need please, maybe with a diagram? Say you are writing *"hello"* and have just written the `e`, what do you want to find? Thank you. – Mark Setchell Jun 21 '19 at 06:21
  • @MarkSetchell Thank you for the response. I have edited my question and added a visualization for what I am trying to do. Can you please have a look to the question again. – Faruk Ahmad Jun 21 '19 at 07:22
  • You're likely going to need some more features than pure PIL, so you could add OpenCV or scikit-image into the mix. Is either, or both, or neither acceptable? – Mark Setchell Jun 21 '19 at 07:57
  • @MarkSetchell yes, opencv or scikit-image both are fine. can you please suggest any idea to start with? – Faruk Ahmad Jun 21 '19 at 08:19
  • Have a look at my 3 answers here... https://stackoverflow.com/a/56473372/2836621 – Mark Setchell Jun 21 '19 at 08:50
  • Hey @FarukAhmad, which solution did you end up using, if you don't mind me asking? – Christian Steinmeyer Mar 23 '22 at 08:37

0 Answers0