質問編集履歴

3

追記

2019/06/03 06:04

投稿

SpecialTukimiya
SpecialTukimiya

スコア192

test CHANGED
File without changes
test CHANGED
@@ -29,6 +29,8 @@
29
29
  ダメなコード
30
30
 
31
31
  ```python
32
+
33
+
32
34
 
33
35
  import cv2
34
36
 
@@ -91,3 +93,53 @@
91
93
 
92
94
 
93
95
  ```
96
+
97
+ #追記
98
+
99
+ テンプレートマッチグと言うモノを試してみたのですが、検出されませんでした。
100
+
101
+ ディスプレイの明るさやOnboardの透明度など触ってますが、この状態で検出できればと思います。
102
+
103
+
104
+
105
+ ![イメージ説明](e32acf657158c6c16cc7c549ca619c8f.png)
106
+
107
+
108
+
109
+ ```python
110
+
111
+
112
+
113
+ import cv2
114
+
115
+ import numpy as np
116
+
117
+ from matplotlib import pyplot as plt
118
+
119
+
120
+
121
+ img_rgb = cv2.imread('sh.png')
122
+
123
+ img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
124
+
125
+ template = cv2.imread('on.png',0)
126
+
127
+ w, h = template.shape[::-1]
128
+
129
+
130
+
131
+ res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
132
+
133
+ threshold = 0.8
134
+
135
+ loc = np.where( res >= threshold)
136
+
137
+ for pt in zip(*loc[::-1]):
138
+
139
+ cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0,0,255), 2)
140
+
141
+
142
+
143
+ cv2.imwrite('res.png',img_rgb)
144
+
145
+ ```

2

修正

2019/06/03 06:04

投稿

SpecialTukimiya
SpecialTukimiya

スコア192

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

1

追加

2019/06/03 03:38

投稿

SpecialTukimiya
SpecialTukimiya

スコア192

test CHANGED
File without changes
test CHANGED
File without changes