謝辞:このページで紹介するソフトウエアの作者に感謝します.
2020/05 時点では,動作に TensorFlow 2.0.0 を必要とするため,Python 3.7 が必要になる.
Python の URL: http://www.python.org/
Python 3.7 のインストール手順の詳細は: 別ページで説明している.
コマンドプロンプトを管理者として実行し,次のコマンドを実行.
python -m pip install -U pip setuptools jupyterlab jupyter jupyter-console jupytext nteract_on_jupyter spyder
※ 「 python -m pip install ...」は,Python パッケージをインストールするためのコマンド.
※ 「 py -3.7 」は,Python 3.7 を起動するためのもの
py -3.7 -m pip install -U pip setuptools py -3.7 -m pip install ISR
https://github.com/idealo/image-super-resolutionで公開されているプログラムを書き替えて使用.
次のプログラムを a.py のようなファイル名で保存
import numpy as np
import sys
from PIL import Image
from ISR.models import RDN
img = Image.open('sys.argv[1]')
lr_img = np.array(img)
rdn = RDN(weights='psnr-small')
sr_img = rdn.predict(lr_img)
result = Image.fromarray(sr_img)
result.save('sys.argv[2]')
py -3.7 a.py sample2-0000001.png a.png
結果を確認.
下は,メガネ部分の拡大
下は,メガネ部分の拡大