teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

誤字

2020/12/13 14:33

投稿

huton
huton

スコア30

title CHANGED
File without changes
body CHANGED
@@ -10,14 +10,13 @@
10
10
  cap = cv2.VideoCapture(0)
11
11
  while(cap.isOpened()):
12
12
      ret, frame = cap.read()
13
-     img = np.zeros((200,500,3),np.uint8)
14
13
      # 表示する色
15
14
  b,g,r,a = 0,255,0,0 #B(青)・G(緑)・R(赤)・A(透明度)
16
15
  # 表示させる文字
17
16
  message = 'OpenCV(オープンシーブイ)'
18
- fontpath ='C:\Windows\Fonts\AcadEref.ttf'
17
+ fontpath ='C:\Windows\Fonts\HGRPP1.TTC'
19
18
  font = ImageFont.truetype(fontpath, 32) # フォントサイズが32
20
- img_pil = Image.fromarray(img)# 配列の各値を8bit(1byte)整数型(0~255)をPIL Imageに変換。
19
+ img_pil = Image.fromarray(frame)# 配列の各値を8bit(1byte)整数型(0~255)をPIL Imageに変換。
21
20
  draw = ImageDraw.Draw(img_pil)# drawインスタンスを生成
22
21
  position = (10,80) # テキスト表示位置
23
22
  draw.text(position, message, font = font , fill = (b, g, r, a) )# drawにテキストを記載 fill:色 BGRA (RGB)

1

誤字

2020/12/13 14:32

投稿

huton
huton

スコア30

title CHANGED
File without changes
body CHANGED
@@ -10,13 +10,14 @@
10
10
  cap = cv2.VideoCapture(0)
11
11
  while(cap.isOpened()):
12
12
      ret, frame = cap.read()
13
+     img = np.zeros((200,500,3),np.uint8)
13
14
      # 表示する色
14
15
  b,g,r,a = 0,255,0,0 #B(青)・G(緑)・R(赤)・A(透明度)
15
16
  # 表示させる文字
16
17
  message = 'OpenCV(オープンシーブイ)'
17
18
  fontpath ='C:\Windows\Fonts\AcadEref.ttf'
18
19
  font = ImageFont.truetype(fontpath, 32) # フォントサイズが32
19
- img_pil = Image.fromarray(frame)# 配列の各値を8bit(1byte)整数型(0~255)をPIL Imageに変換。
20
+ img_pil = Image.fromarray(img)# 配列の各値を8bit(1byte)整数型(0~255)をPIL Imageに変換。
20
21
  draw = ImageDraw.Draw(img_pil)# drawインスタンスを生成
21
22
  position = (10,80) # テキスト表示位置
22
23
  draw.text(position, message, font = font , fill = (b, g, r, a) )# drawにテキストを記載 fill:色 BGRA (RGB)