py123d_detection.torch.data.cameras¶
Reading a rig’s images for one frame, already in network geometry.
Per camera: compose the rig’s fixed crop with the sample’s resize, crop and flip into one affine map, decode the image, resample it once through the map, and move the intrinsics by the same map. Calibration and image size come from the log’s camera metadata, which is rig-static in 123D, so the map is known before any pixel is decoded.
That lets the decoder do the first part of a large reduction. When the network input is at most half the sensor resolution, the image is decoded at 1/2, 1/4 or 1/8 size, for JPEG in the DCT domain. That is several times faster than a full decode and a proper low-pass filter, where a bilinear warp over a 2x reduction samples single pixels and aliases.
Images stay uint8. Normalisation is the model’s job, on the device; see
normalize_images().
Functions
|
The largest reduction in 1, 2, 4, 8 that still leaves the warp at or below full resolution. |
|
Map from a possibly reduced decode's pixel coordinates to the recorded image's. |
Classes
|
One camera's rig-static calibration. |
|
Loads |
|
A rig's images for one frame, with the matrices that go with them. |
- class py123d_detection.torch.data.cameras.Calibration(ego_to_camera, intrinsics, height, width)[source]¶
Bases:
objectOne camera’s rig-static calibration.
- class py123d_detection.torch.data.cameras.Cameras(images, intrinsics, extrinsics, valid, source_sizes, size)[source]¶
Bases:
objectA rig’s images for one frame, with the matrices that go with them.
- class py123d_detection.torch.data.cameras.CameraLoader(rig, images, missing_camera='skip')[source]¶
Bases:
objectLoads
Camerasfor a rig at one network input size.- Parameters:
missing_camera (
str) –"skip"rejects a frame with a camera missing,"zero"keeps it with that camera blank and marked invalid.
- load(scene, iteration, draw)[source]¶
The rig’s cameras at one iteration, or
Noneif the frame cannot be used.
- py123d_detection.torch.data.cameras.decode_factor(matrix)[source]¶
The largest reduction in 1, 2, 4, 8 that still leaves the warp at or below full resolution.
A reduction is only taken where the result would still be at least as fine as the network input along both axes, so nothing the network could have seen is lost.
- Return type:
- py123d_detection.torch.data.cameras.decoded_to_source(shape, height, width)[source]¶
Map from a possibly reduced decode’s pixel coordinates to the recorded image’s.
A factor-
freduction averagesfsource pixels into one, so decoded pixeljsits atf * j + (f - 1) / 2in the recorded image. The identity when nothing was reduced.- Return type: