(xyz, Z, Y, X, clamp_extreme=True)
| 205 | return grid_y, grid_x |
| 206 | |
| 207 | def normalize_gridcloud3d(xyz, Z, Y, X, clamp_extreme=True): |
| 208 | # make things in [-1,1] |
| 209 | x = xyz[...,0] |
| 210 | y = xyz[...,1] |
| 211 | z = xyz[...,2] |
| 212 | |
| 213 | z = 2.0*(z / float(Z-1)) - 1.0 |
| 214 | y = 2.0*(y / float(Y-1)) - 1.0 |
| 215 | x = 2.0*(x / float(X-1)) - 1.0 |
| 216 | |
| 217 | xyz = torch.stack([x,y,z], dim=-1) |
| 218 | |
| 219 | if clamp_extreme: |
| 220 | xyz = torch.clamp(xyz, min=-2.0, max=2.0) |
| 221 | return xyz |
| 222 | |
| 223 | def normalize_gridcloud2d(xy, Y, X, clamp_extreme=True): |
| 224 | # make things in [-1,1] |
no outgoing calls
no test coverage detected