質問編集履歴
3
文言のミス表記改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,4 +132,4 @@
|
|
132
132
|
|
133
133
|
```
|
134
134
|
|
135
|
-
おそらく
|
135
|
+
おそらく第二引数が指定されていないとのことなのですが、エラー解消方法がわからず困っています。
|
2
掲載したプログラムに誤りがありました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,29 +6,9 @@
|
|
6
6
|
|
7
7
|
import numpy as np
|
8
8
|
|
9
|
-
from PIL
|
9
|
+
from PIL
|
10
10
|
|
11
11
|
|
12
|
-
|
13
|
-
#H:色相 S:彩度 V:明度
|
14
|
-
|
15
|
-
#front.jpg
|
16
|
-
|
17
|
-
#def H_MAX 255
|
18
|
-
|
19
|
-
#def H_MIN 0
|
20
|
-
|
21
|
-
#def S_MAX 255
|
22
|
-
|
23
|
-
#def S_MIN 100
|
24
|
-
|
25
|
-
#def V_MAX 250
|
26
|
-
|
27
|
-
#def V_MIN 40
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#mihon.jpg
|
32
12
|
|
33
13
|
H_MAX = 255;
|
34
14
|
|
1
掲載したプログラムに誤りがありました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,6 +9,26 @@
|
|
9
9
|
from PIL import Image
|
10
10
|
|
11
11
|
|
12
|
+
|
13
|
+
#H:色相 S:彩度 V:明度
|
14
|
+
|
15
|
+
#front.jpg
|
16
|
+
|
17
|
+
#def H_MAX 255
|
18
|
+
|
19
|
+
#def H_MIN 0
|
20
|
+
|
21
|
+
#def S_MAX 255
|
22
|
+
|
23
|
+
#def S_MIN 100
|
24
|
+
|
25
|
+
#def V_MAX 250
|
26
|
+
|
27
|
+
#def V_MIN 40
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
#mihon.jpg
|
12
32
|
|
13
33
|
H_MAX = 255;
|
14
34
|
|
@@ -30,7 +50,11 @@
|
|
30
50
|
|
31
51
|
img = Image.open(r'./sample.jpg')
|
32
52
|
|
33
|
-
im = np.asarray(img)
|
53
|
+
#im = np.asarray(img)
|
54
|
+
|
55
|
+
#img = cv2.imread(im, cv2.IMREAD_sCOLOR)
|
56
|
+
|
57
|
+
cv2.imshow(img)
|
34
58
|
|
35
59
|
|
36
60
|
|
@@ -40,17 +64,15 @@
|
|
40
64
|
|
41
65
|
|
42
66
|
|
43
|
-
Mat hsv_image, mask_image, output_image
|
67
|
+
#Mat hsv_image, mask_image, output_image
|
44
68
|
|
45
69
|
|
46
70
|
|
47
|
-
GRAY=1
|
71
|
+
#GRAY=1
|
48
72
|
|
49
73
|
def create_image(type, rows, cols, data):
|
50
74
|
|
51
75
|
|
52
|
-
|
53
|
-
if type == GRAY:
|
54
76
|
|
55
77
|
hsv_image=numpy.frombuffer(data, dtype=np.uint8).reshape((rows, cols))
|
56
78
|
|
@@ -58,15 +80,9 @@
|
|
58
80
|
|
59
81
|
output_image=numpy.frombuffer(data, dtype=np.uint8).reshape((rows, cols))
|
60
82
|
|
61
|
-
|
83
|
+
|
62
84
|
|
63
85
|
gray = cv2.cvtColor(self.image, cv2.COLOR_BGR2GRAY)
|
64
|
-
|
65
|
-
else:
|
66
|
-
|
67
|
-
hsv_image=numpy.frombuffer(data, dtype=np.uint8).reshape((rows, cols))
|
68
|
-
|
69
|
-
output_image=numpy.frombuffer(data, dtype=np.uint8).reshape((rows, cols))
|
70
86
|
|
71
87
|
|
72
88
|
|
@@ -118,6 +134,8 @@
|
|
118
134
|
|
119
135
|
|
120
136
|
|
137
|
+
|
138
|
+
|
121
139
|
```
|
122
140
|
|
123
141
|
c++のコードをpythonに書き換えているのですが、上記のコードを実行すると
|