Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheng222 committed Mar 7, 2020
1 parent 80b3783 commit 874344e
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 0 deletions.
Binary file removed Set5/Set5_HR/baby.bmp
Binary file not shown.
Binary file removed Set5/Set5_HR/bird.bmp
Binary file not shown.
Binary file removed Set5/Set5_HR/butterfly.bmp
Binary file not shown.
Binary file removed Set5/Set5_HR/head.bmp
Binary file not shown.
Binary file removed Set5/Set5_HR/woman.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x2/babyx2.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x2/birdx2.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x2/butterflyx2.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x2/headx2.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x2/womanx2.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x3/babyx3.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x3/birdx3.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x3/butterflyx3.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x3/headx3.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x3/womanx3.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x4/babyx4.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x4/birdx4.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x4/butterflyx4.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x4/headx4.bmp
Binary file not shown.
Binary file removed Set5/Set5_LR_x4/womanx4.bmp
Binary file not shown.
38 changes: 38 additions & 0 deletions scripts/png2npy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import os
import argparse
import skimage.io as sio
import numpy as np

parser = argparse.ArgumentParser(description='Pre-processing .png images')
parser.add_argument('--pathFrom', default='',
help='directory of images to convert')
parser.add_argument('--pathTo', default='',
help='directory of images to save')
parser.add_argument('--split', default=True,
help='save individual images')
parser.add_argument('--select', default='',
help='select certain path')

args = parser.parse_args()

for (path, dirs, files) in os.walk(args.pathFrom):
print(path)
targetDir = os.path.join(args.pathTo, path[len(args.pathFrom) + 1:])
if len(args.select) > 0 and path.find(args.select) == -1:
continue

if not os.path.exists(targetDir):
os.mkdir(targetDir)

if len(dirs) == 0:
pack = {}
n = 0
for fileName in files:
(idx, ext) = os.path.splitext(fileName)
if ext == '.png':
image = sio.imread(os.path.join(path, fileName))
if args.split:
np.save(os.path.join(targetDir, idx + '.npy'), image)
n += 1
if n % 100 == 0:
print('Converted ' + str(n) + ' images.')

0 comments on commit 874344e

Please sign in to comment.