回答編集履歴
1
d
answer
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
numpy.where() をお使いください。
|
2
2
|
|
3
|
+
[numpy.where — NumPy v1.17 Manual](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html)
|
4
|
+
|
3
5
|
```
|
4
6
|
np.where(条件, 条件式が成り立つ場合の値, 条件式が成り立たない場合の値)
|
5
7
|
```
|
6
8
|
|
9
|
+
今回10または50の値かどうかで色を分けたいとのことなので、条件式は `(img == 10) | (img == 50)` になります。
|
7
10
|
|
11
|
+
|
8
12
|
```python
|
9
13
|
import matplotlib.pyplot as plt
|
10
14
|
import numpy as np
|