回答編集履歴
1
for文の意味をくんでみて追記
answer
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
return (0,0),0,thresh
|
11
11
|
return(0,0),0,thresh
|
12
12
|
```
|
13
|
-
となっていますが、これだと、
|
13
|
+
となっていますが、これだと、 contours が0個だと None が返り、TypeError: 'NoneType' object is not iterable のエラーになってしまうのではないでしょうか。それに if-else の中が両方とも return なので最後の行が実行されることはありません。
|
14
14
|
```python
|
15
15
|
def getCircle(masked_img,t,r,Orbit):
|
16
16
|
<省略>
|
@@ -22,4 +22,15 @@
|
|
22
22
|
return (0,0),0,thresh
|
23
23
|
return(0,0),0,thresh
|
24
24
|
```
|
25
|
-
が正しいのではないですか?
|
25
|
+
が正しいのではないですか?
|
26
|
+
これでも contours が複数あっても最初の1個しか見ないのはおかしいので、本当は
|
27
|
+
```python
|
28
|
+
def getCircle(masked_img,t,r,Orbit):
|
29
|
+
<省略>
|
30
|
+
for cnt in contours:
|
31
|
+
<省略>
|
32
|
+
if radius>r:
|
33
|
+
return center,radius,thresh
|
34
|
+
return(0,0),0,thresh
|
35
|
+
```
|
36
|
+
となってるべきではないかとも思います。
|