Hi there!
In my research, I needed to use your project to generate some images with texts along with masks, labels and bounding boxes. I added some new features to it, and here is my PR:
- made this code compatible with mac OS (it was impossible to satisfy dependencies, a lot of problems with
pyplot
and others) - removed deprecated api calls: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hold.html
pyplot.hold(True)
- works by default since version3.0
(and the method is removed),scipy.misc.imsave
- replaced with recommendedimageio.imwrite
) - updated requirements.txt
- improved code formatting (used auto-formatting tool)
- improved and added more of documentation. Used docstrings style by Google. See this for different formats examples https://stackoverflow.com/a/24385103/2877029
- implemented a new feature: with
--output-masks
flag users can obtain text masks used to place text to the image (see "_mask.png" files), and bounding boxes of each word with a label (see "_bb.txt" files). Run with this flag and see the content of "./masks/" folder for more examples - moved output visualization (--viz flag) out of renderer - no need to propagate this flag to renderer logic: Following the single responsibility principle: renderer should render, a generator should generate (and, optionally, display result for users)
- added debug logs and --debug flag, which enables more logs to be printed. Tested combinations "--viz --debug" "--viz --output-masks", "--viz --output-masks --debug" "--output-masks --debug".
Let's work together on merging this contribution to your project.
Btw, I'd very much encourage you to make it python3 by default.