LoginSignup
4
1

More than 3 years have passed since last update.

【Python】openCVで日本語の文字を扱う方法

Last updated at Posted at 2020-09-03

毎回使う時に調べているので
備忘録として残します。

image = cv2.puttext(image,"ハローワールド", (0, 0), '<フォントのパス>', 10, (0, 0, 0),2,False)

引数
  画像、文字列、描写する座標、フォントのパス、文字のサイズ、文字の色、文字の太さ、画像の原点の位置(Trueが左下Falseが左上)

そのままでは日本語が表示出来ない理由は、
CV2にはデフォルトではマルチバイト文字に対応していないため。

つまり、日本語のフォントを指定してやる事により画像に日本語を描画する事が出来ます。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1