質問編集履歴
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -72,4 +72,40 @@
|
|
72
72
|
|
73
73
|
plt.imshow(image, cmap="gray")
|
74
74
|
|
75
|
+
---------------------------------------------------------------------------
|
76
|
+
|
77
|
+
ValueError Traceback (most recent call last)
|
78
|
+
|
79
|
+
<ipython-input-134-049f4411d5be> in <module>()
|
80
|
+
|
81
|
+
9 a = a
|
82
|
+
|
83
|
+
10
|
84
|
+
|
85
|
+
---> 11 image[i][np.min(b):np.max(b)]=1
|
86
|
+
|
87
|
+
12
|
88
|
+
|
89
|
+
13 plt.imshow(image, cmap="gray")
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
1 frames
|
94
|
+
|
95
|
+
/usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
|
96
|
+
|
97
|
+
84 return reduction(axis=axis, out=out, **passkwargs)
|
98
|
+
|
99
|
+
85
|
100
|
+
|
101
|
+
---> 86 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
|
102
|
+
|
103
|
+
87
|
104
|
+
|
105
|
+
88
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
ValueError: zero-size array to reduction operation minimum which has no identity
|
110
|
+
|
75
111
|
```
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -37,3 +37,39 @@
|
|
37
37
|
|
38
38
|
|
39
39
|
OpenCVで```cv2.fillPoly```を使ったところ、囲われた部分を完全に塗りつぶし切れておらず、空白部分があったため、素朴な方法でも試してみたいです。
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
for文でも書こうとしたが不慣れなためかうまくいかない
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
# lineが元データ
|
48
|
+
|
49
|
+
a = np.array([])
|
50
|
+
|
51
|
+
b = np.array([])
|
52
|
+
|
53
|
+
image = np.zeros((384, 384))
|
54
|
+
|
55
|
+
for i in range(1,384):
|
56
|
+
|
57
|
+
for j in range(1,384):
|
58
|
+
|
59
|
+
if line[i][j] == 1:
|
60
|
+
|
61
|
+
b = np.append(a,np.array(i))
|
62
|
+
|
63
|
+
else:
|
64
|
+
|
65
|
+
a = a
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
image[i][np.min(b):np.max(b)]=1
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
plt.imshow(image, cmap="gray")
|
74
|
+
|
75
|
+
```
|
1
追記依頼をうけて
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
0/1の値で構成された384×384配列の、1で囲まれた部分のすべての値を1に変え
|
9
|
+
0/1の値で構成された384×384配列の、1で囲まれた部分のすべての値を1に変えたいです。
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -27,3 +27,13 @@
|
|
27
27
|
|
28
28
|
|
29
29
|
また、初学者なので丁寧にご教示いただけると幸いです。
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
### 試したこと
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
OpenCVで```cv2.fillPoly```を使ったところ、囲われた部分を完全に塗りつぶし切れておらず、空白部分があったため、素朴な方法でも試してみたいです。
|