回答編集履歴
5
追記
answer
CHANGED
@@ -30,6 +30,5 @@
|
|
30
30
|
◇実行結果
|
31
31
|

|
32
32
|
◇参考情報
|
33
|
-
[【OpenCV; Python】findcontours関数のまとめ](https://qiita.com/anyamaru/items/fd3d894966a98098376c)
|
33
|
+
0. [【OpenCV; Python】findcontours関数のまとめ](https://qiita.com/anyamaru/items/fd3d894966a98098376c)
|
34
|
-
|
35
|
-
|
34
|
+
0. [AdaptiveThresholdSimulator](https://github.com/umyuu/AdaptiveThresholdSimulator)
|
4
追記
answer
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
assert img is not None, FILE_NAME
|
16
16
|
|
17
17
|
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
18
|
-
ret = cv2.adaptiveThreshold(img_gray, 255,
|
18
|
+
ret = cv2.adaptiveThreshold(img_gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 11, 3)
|
19
19
|
imshow(ret)
|
20
20
|
im2, contours, hierarchy = cv2.findContours(ret, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_TC89_L1)
|
21
21
|
for c in contours:
|
3
追記
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
[cv2.adaptiveThreshold](https://docs.opencv.org/3.4.0/d7/d4d/tutorial_py_thresholding.html)を使った抽出です、ご参考まで。
|
2
2
|
|
3
3
|
```Python
|
4
4
|
import cv2
|
@@ -27,6 +27,8 @@
|
|
27
27
|
main()
|
28
28
|
|
29
29
|
```
|
30
|
+
◇実行結果
|
31
|
+

|
30
32
|
◇参考情報
|
31
33
|
[【OpenCV; Python】findcontours関数のまとめ](https://qiita.com/anyamaru/items/fd3d894966a98098376c)
|
32
34
|
|
2
追記
answer
CHANGED
@@ -30,4 +30,4 @@
|
|
30
30
|
◇参考情報
|
31
31
|
[【OpenCV; Python】findcontours関数のまとめ](https://qiita.com/anyamaru/items/fd3d894966a98098376c)
|
32
32
|
|
33
|
-
手前味噌ですが、GitHubに[AdaptiveThresholdSimulator](https://github.com/umyuu/AdaptiveThresholdSimulator)を公開してたりもします。
|
33
|
+
手前味噌ですが、`cv2.adaptiveThreshold`の`parameter`チェック用に`GitHub`に[AdaptiveThresholdSimulator](https://github.com/umyuu/AdaptiveThresholdSimulator)を公開してたりもします。
|
1
追記
answer
CHANGED
@@ -28,4 +28,6 @@
|
|
28
28
|
|
29
29
|
```
|
30
30
|
◇参考情報
|
31
|
-
[【OpenCV; Python】findcontours関数のまとめ](https://qiita.com/anyamaru/items/fd3d894966a98098376c)
|
31
|
+
[【OpenCV; Python】findcontours関数のまとめ](https://qiita.com/anyamaru/items/fd3d894966a98098376c)
|
32
|
+
|
33
|
+
手前味噌ですが、GitHubに[AdaptiveThresholdSimulator](https://github.com/umyuu/AdaptiveThresholdSimulator)を公開してたりもします。
|