in lib/evaluator.py [0:0]
def get_reproj_normal_error(self, frontal=True, back=True, left=True, right=True, save_demo_img=None):
# reproj error
# if save_demo_img is not None, save a visualization at the given path (etc, "./test.png")
if self._normal_render is None:
print("In order to use normal render, "
"you have to call init_gl() before initialing any evaluator objects.")
return -1
side_cnt = 0
total_error = 0
demo_list = []
if frontal:
side_cnt += 1
error, src_normal, tgt_normal = self._get_reproj_normal_error(0)
total_error += error
demo_list.append(np.concatenate([src_normal, tgt_normal], axis=0))
if back:
side_cnt += 1
error, src_normal, tgt_normal = self._get_reproj_normal_error(180)
total_error += error
demo_list.append(np.concatenate([src_normal, tgt_normal], axis=0))
if left:
side_cnt += 1
error, src_normal, tgt_normal = self._get_reproj_normal_error(90)
total_error += error
demo_list.append(np.concatenate([src_normal, tgt_normal], axis=0))
if right:
side_cnt += 1
error, src_normal, tgt_normal = self._get_reproj_normal_error(270)
total_error += error
demo_list.append(np.concatenate([src_normal, tgt_normal], axis=0))
if save_demo_img is not None:
res_array = np.concatenate(demo_list, axis=1)
res_img = Image.fromarray((res_array * 255).astype(np.uint8))
res_img.save(save_demo_img)
return total_error / side_cnt