-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcamera_errors.py
More file actions
32 lines (25 loc) · 1.06 KB
/
camera_errors.py
File metadata and controls
32 lines (25 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
os.environ['OPENCV_IO_ENABLE_OPENEXR'] = '1'
import cv2
import json
import numpy as np
depth_image_mean_error = 0
num_images = 0
index = 0
for camera in scene['images_data']:
cameraPath = camera['image_name'].replace('png', 'exr')
if cameraPath in views:
poseId = views[cameraPath]['poseId']
groundtruth = cv2.imread('./render/depth/img_{:03}_depth.exr'.format(index), cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH)
groundtruth = groundtruth[:, :, 0]
genimage = cv2.imread(f'./render/08_DepthMapFilter/{poseId}_depthMap.exr', cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH)
genimage = s * genimage
groundtruth[groundtruth > 1e8] = np.nan
genimage[genimage < 0.0] = np.nan
mean_error = np.nanmean(np.abs(genimage - groundtruth))
print(f'Depth image mean error {mean_error}')
depth_image_mean_error += mean_error
num_images += 1
index += 1
depth_image_mean_error = depth_image_mean_error / num_images
print(f'Depth images mean error {depth_image_mean_error}')