Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
numpy array画像から形状(height, width, 3)を読み込んでいます。[0, 0, 0]すべての黒のピクセルを特定の色に置き換えたい[r, g, b]。これを行う方法はありnumpyますか?
numpy array
(height, width, 3)
[0, 0, 0]
[r, g, b]
numpy
import numpy as np orig_color = (0, 0, 0) replacement_color = (r, g, b) data[(data == orig_color).all(axis = -1)] = replacement_color