()
| 104 | |
| 105 | |
| 106 | def main(): |
| 107 | args = parse_args() |
| 108 | |
| 109 | if args.min_depth_percentile > args.max_depth_percentile: |
| 110 | raise ValueError("min_depth_percentile should be less than or equal " |
| 111 | "to the max_depth_perceintile.") |
| 112 | |
| 113 | # Read depth and normal maps corresponding to the same image. |
| 114 | if not os.path.exists(args.depth_map): |
| 115 | raise FileNotFoundError("File not found: {}".format(args.depth_map)) |
| 116 | |
| 117 | if not os.path.exists(args.normal_map): |
| 118 | raise FileNotFoundError("File not found: {}".format(args.normal_map)) |
| 119 | |
| 120 | depth_map = read_array(args.depth_map) |
| 121 | normal_map = read_array(args.normal_map) |
| 122 | |
| 123 | min_depth, max_depth = np.percentile( |
| 124 | depth_map, [args.min_depth_percentile, args.max_depth_percentile]) |
| 125 | depth_map[depth_map < min_depth] = min_depth |
| 126 | depth_map[depth_map > max_depth] = max_depth |
| 127 | |
| 128 | import pylab as plt |
| 129 | |
| 130 | # Visualize the depth map. |
| 131 | plt.figure() |
| 132 | plt.imshow(depth_map) |
| 133 | plt.title("depth map") |
| 134 | |
| 135 | # Visualize the normal map. |
| 136 | plt.figure() |
| 137 | plt.imshow(normal_map) |
| 138 | plt.title("normal map") |
| 139 | |
| 140 | plt.show() |
| 141 | |
| 142 | |
| 143 | if __name__ == "__main__": |
no test coverage detected