我在Python中使用pytesseract库从图像中提取文本。如何获得文本的字体大小?我使用了以下代码:
image = cv2.imread('sample.png')
# Get verbose data including boxes, confidences, line and page numbers
iterator = pytesseract.image_to_data(gray)
rows = iterator.strip().split('\n')
arr = [row.split() for row in rows]
print(iterator)
迭代器输出如下信息:
arr[4][9] refers to the height of the word in pixels but not the font size. If I use this data to render the word in a canvas, the image will look like the image below:
我想要字体大小,而不是单词的高度(以像素为单位)。有可能吗?