雑多な技術系メモ

自分用のメモ。内容は保証しません。よろしくお願いします。

pillow

Pillow で画像をグレー(灰色)に

まず元の画像 >>> img = Image.open("./crowncat4020138_TP_V.jpg") >>> plt.imshow(img) <matplotlib.image.AxesImage at 0x7f62e821bac8> グレーにする >>> img_gray = img.convert("LA") >>> plt.imshow(img_gray) <matplotlib.image.AxesImage at 0x7f62e8043160></matplotlib.image.axesimage></matplotlib.image.axesimage>

numpy.array形式のデータから画像を表示する

numpy.array形式のデータから画像を表示する。 画像はopen ai gymのゲーム >>> sample array([[[0, 0, 0], [0, 0, 0], [0, 0, 0], ..., [0, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0], ..., [0, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, …