Function
build_projection_matrix
(w, h, fov, is_behind_camera=False)
Source from the content-addressed store, hash-verified
| 135 | return math.sqrt((loc1.x-loc2.x)**2+(loc1.y-loc2.y)**2) |
| 136 | |
| 137 | def build_projection_matrix(w, h, fov, is_behind_camera=False): |
| 138 | focal = w / (2.0 * np.tan(fov * np.pi / 360.0)) |
| 139 | K = np.identity(3) |
| 140 | |
| 141 | if is_behind_camera: |
| 142 | K[0, 0] = K[1, 1] = -focal |
| 143 | else: |
| 144 | K[0, 0] = K[1, 1] = focal |
| 145 | |
| 146 | K[0, 2] = w / 2.0 |
| 147 | K[1, 2] = h / 2.0 |
| 148 | return K |
| 149 | |
| 150 | def convert_depth(data): |
| 151 | """ |
Tested by
no test coverage detected