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

質問編集履歴

3

追記

2019/06/03 06:04

投稿

SpecialTukimiya
SpecialTukimiya

スコア192

title CHANGED
File without changes
body CHANGED
@@ -14,6 +14,7 @@
14
14
  #
15
15
  ダメなコード
16
16
  ```python
17
+
17
18
  import cv2
18
19
  import numpy as np
19
20
 
@@ -44,4 +45,29 @@
44
45
  cv2.destroyAllWindows()
45
46
 
46
47
 
48
+ ```
49
+ #追記
50
+ テンプレートマッチグと言うモノを試してみたのですが、検出されませんでした。
51
+ ディスプレイの明るさやOnboardの透明度など触ってますが、この状態で検出できればと思います。
52
+
53
+ ![イメージ説明](e32acf657158c6c16cc7c549ca619c8f.png)
54
+
55
+ ```python
56
+
57
+ import cv2
58
+ import numpy as np
59
+ from matplotlib import pyplot as plt
60
+
61
+ img_rgb = cv2.imread('sh.png')
62
+ img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
63
+ template = cv2.imread('on.png',0)
64
+ w, h = template.shape[::-1]
65
+
66
+ res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
67
+ threshold = 0.8
68
+ loc = np.where( res >= threshold)
69
+ for pt in zip(*loc[::-1]):
70
+ cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0,0,255), 2)
71
+
72
+ cv2.imwrite('res.png',img_rgb)
47
73
  ```

2

修正

2019/06/03 06:04

投稿

SpecialTukimiya
SpecialTukimiya

スコア192

title CHANGED
@@ -1,1 +1,1 @@
1
- python3 linux mint18 特定の画像を検出
1
+ python3 OpenCV 特定の画像を検出
body CHANGED
File without changes

1

追加

2019/06/03 03:38

投稿

SpecialTukimiya
SpecialTukimiya

スコア192

title CHANGED
File without changes
body CHANGED
File without changes