PSMNet icon indicating copy to clipboard operation
PSMNet copied to clipboard

duplicate files

Open midjji opened this issue 6 years ago • 1 comments

the readpfm and preprocess are duplicated, with one copy in utils and one in dataloader. please remove one.

the readpfm is out of date and wont recognize all pfms correctly. should be:

def readPFM(file): file = open(file, 'rb')

color = None
width = None
height = None
scale = None
endian = None

header = file.readline().rstrip()
if header.decode("ascii") == 'PF':
    color = True
elif header.decode("ascii") == 'Pf':
    color = False
else:
    raise Exception('Not a PFM file.')

dim_match = re.match(r'^(\d+)\s(\d+)\s$', file.readline().decode("ascii"))
if dim_match:
    width, height = list(map(int, dim_match.groups()))
else:
    raise Exception('Malformed PFM header.')

scale = float(file.readline().decode("ascii").rstrip())
if scale < 0: # little-endian
    endian = '<'
    scale = -scale
else:
    endian = '>' # big-endian

data = np.fromfile(file, endian + 'f')
shape = (height, width, 3) if color else (height, width)

data = np.reshape(data, shape)
data = np.flipud(data)
return data

midjji avatar Oct 23 '18 11:10 midjji

it works,thank you!

kearcer avatar Jul 29 '20 10:07 kearcer