Get image size from settings

This commit is contained in:
Cpt.Captain 2022-02-22 13:29:30 +01:00
parent 5202ddfbe9
commit bcb1e2c6ff

View File

@ -143,8 +143,8 @@ def create_data(out_root, idx, n_samples, imsize, patterns, K, baseline, blend_i
fy = K[1, 1] * scale
px = K[0, 2] * scale
py = K[1, 2] * scale
im_height = imsize[0] * scale
im_width = imsize[1] * scale
im_height = imsize[0] * scale // 1
im_width = imsize[1] * scale // 1
cams.append(renderer.PyCamera(fx, fy, px, py, Rcam, tcam, im_width, im_height))
projs.append(renderer.PyCamera(fx, fy, px, py, Rproj, tproj, im_width, im_height))
@ -221,6 +221,7 @@ if __name__ == '__main__':
config = json.load(fp)
data_root = Path(config['DATA_ROOT'])
shapenet_root = config['SHAPENET_ROOT']
settings_imsize = tuple(map(int, config['IMSIZE'].split(',')))
data_type = 'syn'
out_root = data_root / f'{data_type}'
@ -242,6 +243,9 @@ if __name__ == '__main__':
# camera parameters
imsize, K = load_camera_parameters()
# remember what was set in the settings
imsize = settings_imsize
imsizes = [(imsize[0] // (2 ** s), imsize[1] // (2 ** s)) for s in range(4)]
focal_lengths = [K[0, 0] / (2 ** s) for s in range(4)]