回答編集履歴
2
修正
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
- OpenCV3 ⇒ image, contours, hierarchy
|
4
4
|
|
5
|
-
[OpenCV: Structural Analysis and Shape Descriptors](https://docs.opencv.org/3.4.6/d3/dc0/group__imgproc__shape.html#ga9
|
5
|
+
[OpenCV: Structural Analysis and Shape Descriptors](https://docs.opencv.org/3.4.6/d3/dc0/group__imgproc__shape.html#ga17ed9f5d79ae97bd4c7cf18403e1689a)
|
6
6
|
|
7
7
|
- OpenCV4 ⇒ contours, hierarchy
|
8
8
|
|
1
追記
test
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
- OpenCV3 ⇒ image, contours, hierarchy
|
4
4
|
|
5
|
+
[OpenCV: Structural Analysis and Shape Descriptors](https://docs.opencv.org/3.4.6/d3/dc0/group__imgproc__shape.html#ga95f5b48d01abc7c2e0732db24689837b)
|
6
|
+
|
5
7
|
- OpenCV4 ⇒ contours, hierarchy
|
8
|
+
|
9
|
+
[OpenCV: Structural Analysis and Shape Descriptors](https://docs.opencv.org/4.1.0/d3/dc0/group__imgproc__shape.html#gadf1ad6a0b82947fa1fe3c3d497f260e0)
|
6
10
|
|
7
11
|
|
8
12
|
|
@@ -12,7 +16,19 @@
|
|
12
16
|
|
13
17
|
```Python
|
14
18
|
|
15
|
-
|
19
|
+
image, contours, hierarchy = cv2.findContours(...)
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
---
|
26
|
+
|
27
|
+
また質問のようにcontoursしか使わないのならば、次のように書けば充分です。
|
28
|
+
|
29
|
+
```Python
|
30
|
+
|
31
|
+
_, contours, _ = cv2.findContours(...)
|
16
32
|
|
17
33
|
```
|
18
34
|
|
@@ -22,6 +38,6 @@
|
|
22
38
|
|
23
39
|
```Python
|
24
40
|
|
25
|
-
contours
|
41
|
+
contours = cv2.findContours(...)[1]
|
26
42
|
|
27
43
|
```
|