load_camera_params: only integer scalar arrays can be converted to a scalar index
Authur-Morgan opened this issue · 1 comments
camera.py源文件如下:
import h5py
import numpy as np
from pathlib import Path
def load_camera_params(file):
cam_file = Path(file)
cam_params = {}
azimuth = {
'54138969': 70, '55011271': -70, '58860488': 110, '60457274': -100
}
with h5py.File(cam_file) as f:
subjects = [1, 5, 6, 7, 8, 9, 11]
for s in subjects:
cam_params[f'S{s}'] = {}
for _, params in f[f'subject{s}'].items():
name = params['Name']
name = ''.join([chr(c) for c in name])
val = {}
val['R'] = np.array(params['R'])
val['T'] = np.array(params['T'])
val['c'] = np.array(params['c'])
val['f'] = np.array(params['f'])
val['k'] = np.array(params['k'])
val['p'] = np.array(params['p'])
val['azimuth'] = azimuth[name]
cam_params[f'S{s}'][name] = val
return cam_params
在运行语句cam_params = load_camera_params('cameras.h5')[subject][cam_id]
在这一行以及下面很多行都报错
---> 17 name = ''.join([chr(c) for c in name])
TypeError: only integer scalar arrays can be converted to a scalar index
你的问题怎么解决的,我也遇到了同样的问题