How to calculate correct font scale to fit to the image using putText

asked 2019-03-27 04:51:00 -0600

isma gravatar image

Hi,image description(/upfiles/15536799498185134.png)I want to increase the font size of the output I get using put text function,I tried randomly increasing and decreasing font scale variable but it didn't work. Anyone knows how to do this? Thank you! image description

    # show the label
cv2.putText(image, prediction, (20,30), cv2.FONT_HERSHEY_SIMPLEX, 2.0, (0,255,255), 3,8)
print("Prediction - {}".format(prediction))

# display the output image
plt.imshow( image)
edit retag flag offensive close merge delete


as long as you're worrying about font-scales, you're not doing computer-vision ;(

berak gravatar imageberak ( 2019-03-27 04:52:48 -0600 )edit

careful, plt will expect rgb images, opencv uses bgr.

berak gravatar imageberak ( 2019-03-27 04:54:07 -0600 )edit

@berak Those things I know Thanks .Showing meaningful output is also important when documenting your work, Please write if you know the answer

isma gravatar imageisma ( 2019-03-27 05:13:26 -0600 )edit

sure, i'm only teasing you ;)

retrieve the actual size for 2 known font scales, and extrapolate ?

berak gravatar imageberak ( 2019-03-27 05:17:56 -0600 )edit