質問編集履歴

2

コーどの変更

2019/06/07 01:06

投稿

rgb_nk
rgb_nk

スコア26

test CHANGED
File without changes
test CHANGED
@@ -28,22 +28,6 @@
28
28
 
29
29
 
30
30
 
31
- # 保存する
32
-
33
- def storage(image):
34
-
35
- for images in image:
36
-
37
- cv2.imwrite("ret{}.jpg".format(images), images)
38
-
39
- else:
40
-
41
- print('保存終了')
42
-
43
-
44
-
45
- # 輪郭抽出
46
-
47
31
  def contour_extraction(image):
48
32
 
49
33
  hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
@@ -60,13 +44,9 @@
60
44
 
61
45
  contours = list(filter(lambda x: cv2.contourArea(x) > area_thresh, contours))
62
46
 
63
- # create_box(contours)
47
+ create_box(contours)
64
-
65
- return contours
66
48
 
67
49
 
68
-
69
- # バウンディングボックスで囲う
70
50
 
71
51
  def create_box(contours):
72
52
 
@@ -84,17 +64,15 @@
84
64
 
85
65
  cv2.rectangle(image, (x, y), (x + width, y + height), color=(0, 255, 0), thickness=2)
86
66
 
87
-
67
+ for images in image:
88
68
 
89
- storage(image)
69
+ cv2.imwrite('Users/XXXX/Desktop/サーモ/data/hogehoge.jpg', images)
90
70
 
91
- # cv2.imwrite("ret.png", image)
71
+
92
72
 
93
73
 
94
74
 
95
75
 
96
-
97
- # カレントディレクトリ内の画像を渡す
98
76
 
99
77
  path = './*.jpg'
100
78
 
@@ -108,11 +86,7 @@
108
86
 
109
87
  contour_extraction(image)
110
88
 
111
- else:
112
-
113
- print('end')
89
+ print('end')
114
-
115
-
116
90
 
117
91
 
118
92
 

1

コードの全表示

2019/06/07 01:05

投稿

rgb_nk
rgb_nk

スコア26

test CHANGED
File without changes
test CHANGED
@@ -12,11 +12,11 @@
12
12
 
13
13
 
14
14
 
15
- 私が思い描いている様な処理を教えてください。初心者の私では難しすぎます。```ここに言語を入力
15
+ 私が思い描いている様な処理を教えてください。初心者の私では難しすぎます。
16
16
 
17
- コード
18
17
 
18
+
19
- ```
19
+ ```ここに言語を入力
20
20
 
21
21
  import cv2
22
22
 
@@ -50,7 +50,7 @@
50
50
 
51
51
  binary = cv2.inRange(hsv, (20, 0, 0), (50, 255, 255))
52
52
 
53
-
53
+ # 輪郭抽出
54
54
 
55
55
  contours = cv2.findContours(binary, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)[1]
56
56
 
@@ -60,7 +60,7 @@
60
60
 
61
61
  contours = list(filter(lambda x: cv2.contourArea(x) > area_thresh, contours))
62
62
 
63
-
63
+ # create_box(contours)
64
64
 
65
65
  return contours
66
66
 
@@ -114,4 +114,12 @@
114
114
 
115
115
 
116
116
 
117
+
118
+
119
+
120
+
121
+
122
+
123
+ ```
124
+
117
125
  どうかよろしくお願い致しましす。