回答編集履歴
3
d
answer
CHANGED
@@ -46,6 +46,7 @@
|
|
46
46
|
あとは、HoughCircle() は円の一覧を返すので、
|
47
47
|
|
48
48
|
```
|
49
|
+
circles = cv2.HoughCircles(...引数)
|
49
50
|
if circles is not None:
|
50
51
|
circles = circles.squeeze(axis=0) # (1, NumCircles, 3) -> (NumCircles, 3)
|
51
52
|
for cx, cy, r in circles:
|
2
d
answer
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
2. マスク画像と画像の and 演算を行い、検出対象の画素以外を0にする。
|
5
5
|
3. 輝度値を計算する。
|
6
6
|
|
7
|
-
|
8
7
|
```python
|
9
8
|
import cv2
|
10
9
|
import numpy as np
|
@@ -31,6 +30,7 @@
|
|
31
30
|
print(mean) # 146.427660930529
|
32
31
|
```
|
33
32
|
|
33
|
+
|
34
34
|
画像
|
35
35
|
|
36
36
|

|
@@ -41,4 +41,16 @@
|
|
41
41
|
|
42
42
|
の AND 演算を行い、マスクをかける。
|
43
43
|
|
44
|
-

|
44
|
+

|
45
|
+
|
46
|
+
あとは、HoughCircle() は円の一覧を返すので、
|
47
|
+
|
48
|
+
```
|
49
|
+
if circles is not None:
|
50
|
+
circles = circles.squeeze(axis=0) # (1, NumCircles, 3) -> (NumCircles, 3)
|
51
|
+
for cx, cy, r in circles:
|
52
|
+
mean = calc_mean(gray, center=(cx, cy), radius=r)
|
53
|
+
print(mean)
|
54
|
+
```
|
55
|
+
|
56
|
+
とでもしてください。
|
1
d
answer
CHANGED
@@ -31,11 +31,11 @@
|
|
31
31
|
print(mean) # 146.427660930529
|
32
32
|
```
|
33
33
|
|
34
|
-
|
34
|
+
画像
|
35
35
|
|
36
36
|

|
37
37
|
|
38
|
-
と画像
|
38
|
+
とマスク画像
|
39
39
|
|
40
40
|

|
41
41
|
|