(df, out_fn)
| 187 | return sumVels / n |
| 188 | |
| 189 | def point_cloud_data_frame_to_ply(df, out_fn): |
| 190 | with open(out_fn, 'wt') as f: |
| 191 | f.write('\n'.join([ |
| 192 | 'ply', |
| 193 | 'format ascii 1.0', |
| 194 | 'element vertex %d' % len(df), |
| 195 | 'property float x', |
| 196 | 'property float y', |
| 197 | 'property float z', |
| 198 | 'property uint8 red', |
| 199 | 'property uint8 green', |
| 200 | 'property uint8 blue', |
| 201 | 'end_header' |
| 202 | ]) + '\n') |
| 203 | for _, row in df.iterrows(): |
| 204 | r = [] |
| 205 | for prop in 'xyz': r.append(row[prop]) |
| 206 | for prop in 'rgb': r.append(int(row[prop])) |
| 207 | f.write(' '.join([str(v) for v in r]) + '\n') |
| 208 | |
| 209 | def convert_distortion(cam): |
| 210 | coeffs = cam.get('distortionCoefficients', None) |
no test coverage detected