Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the OpenCV font base size for cv::HersheyFonts?

From http://docs.opencv.org/2.4/modules/core/doc/drawing_functions.html#puttext:

fontScale – Font scale factor that is multiplied by the font-specific base size.

What is the base size for the hershey fonts? I can't find it anywhere.

like image 802
Andrew Stromme Avatar asked Sep 17 '17 17:09

Andrew Stromme


Video Answer


2 Answers

There is nothing said in the documentation or anything really readable in the source code.

You can try with using getTextSize To get the size in pixels of the test string with the font you choose, I think it is not monospaced so it varies which letters you use.

like image 198
api55 Avatar answered Oct 07 '22 01:10

api55


When I use Python getTextSize, it returned tuple data structure.

For example,

textSize = cv2.getTextSize(text=str(act_class_info[0]), fontFace=cv2.FONT_HERSHEY_DUPLEX, fontScale=1, thickness=1)
print(textSize)  # ((61, 22), 10)

It looks like (61, 22) is width of three letters and height of one letter in pixel unit. I don't know what the number 10 is meaning.

like image 23
Cloud Cho Avatar answered Oct 06 '22 23:10

Cloud Cho