質問編集履歴

2

リンク内容を追加しました。

2020/01/30 01:55

投稿

stylenanda
stylenanda

スコア10

test CHANGED
File without changes
test CHANGED
@@ -81,3 +81,7 @@
81
81
  繰り返ししたいのが、計算手法などでなく、画像だからエラーが出るのでしょうか
82
82
 
83
83
  エラーの解決方法をどなたか教えてください。
84
+
85
+
86
+
87
+ [リンク内容](https://code-graffiti.com/opencv-template-matching-in-python/)

1

エラーコードを修正しました

2020/01/30 01:54

投稿

stylenanda
stylenanda

スコア10

test CHANGED
File without changes
test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  def draw_window(x, y, dy):
30
30
 
31
- templates_roi = template['[y:y+50, x:x+50]','[y+dy:y+dy+50,x:x+50]']
31
+ templates_roi = [template[y:y+50, x:x+50],template[y+dy:y+dy+50,x:x+50]]
32
32
 
33
33
  for r in templates_roi:
34
34
 
@@ -70,14 +70,14 @@
70
70
 
71
71
  File "<stdin>", line 1, in <module>
72
72
 
73
- File "line 9, in draw_window
73
+ template_roi = eval(r)
74
74
 
75
- templates_roi = template['[y:y+50, x:x+50]','[y+dy:y+dy+50,x:x+50]']
76
-
77
- IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
75
+ TypeError: eval() arg 1 must be a string, bytes or code object
78
76
 
79
77
  ```
80
78
 
81
79
 
82
80
 
83
- エラーは''と[]と,が混合ること理由なと思うのです、ROI抽を行いたいときはどに修正すればいいのどなたか教えてください。
81
+ 繰り返した、計算手法どでなく、画像だらエラーが出でしょうか
82
+
83
+ エラーの解決方法をどなたか教えてください。