回答編集履歴
2
test
CHANGED
@@ -24,6 +24,6 @@
|
|
24
24
|
|
25
25
|
x, y = (2, 2)
|
26
26
|
|
27
|
-
view_as_blocks(img, (x, y,
|
27
|
+
view_as_blocks(img, (x, y, 1)).std((3, 4, 5))
|
28
28
|
|
29
29
|
```
|
1
修正
test
CHANGED
@@ -1,5 +1,29 @@
|
|
1
|
+
## 1. Numpyの`.reshape()`を用いる方法
|
2
|
+
|
3
|
+
|
4
|
+
|
1
5
|
```python
|
2
6
|
|
7
|
+
x, y = (2, 2)
|
8
|
+
|
3
|
-
|
9
|
+
img.reshape(img.shape[0]//x, x, img.shape[1]//y, y, 3).std((1, 3))
|
4
10
|
|
5
11
|
```
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
## 2. Scikit-imageの`view_as_blocks()`を用いる方法
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
```python
|
20
|
+
|
21
|
+
from skimage.util import view_as_blocks
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
x, y = (2, 2)
|
26
|
+
|
27
|
+
view_as_blocks(img, (x, y, 3)).std((2, 3, 4))
|
28
|
+
|
29
|
+
```
|