はじめに
matplotlibのimshowで画像の一部をカラーで表示する方法について解説する。
コード

解説
モジュールのインポート
画像の読み込み
この画像を読み込む。

カラー画像の作成
中心部分以外を0とした画像データとする。
グレースケール画像の作成
rgb2grayにより1次元化してしまうので、np.appendのaxis=2を2回することで同一データで3次元化する。
3次元化したデータの中心部分を0とする。
画像を足して表示
コードをダウンロード(.pyファイル)
コードをダウンロード(.ipynbファイル)
参考
matplotlib.pyplot.imshow — Matplotlib 3.1.2 documentation

[matplotlib] 24. 画像
matplotlibでの画像の取扱方法について説明する。
コメント