Data Structures | |
| struct | BasicDetection |
| One accepted object in final still-image coordinates. More... | |
| struct | BasicResult |
Functions | |
| uint32_t | read_u32 (const uint8_t *data) |
| BasicResult | decode (imx500::Span< const float > tensor, imx500::Span< const uint8_t > info, libcamera::Rectangle crop, libcamera::Size image) |
| BasicResult | frame_result (const imx500::FrameView &frame) |
| Interpret only the detector model's outputs from this retained exposure. | |
| bool | detector_ready (const imx500::FrameView &frame) |
| Qualify startup from a valid detector head, including zero detections. | |
| bool | write_detections (const imx500::FrameView &frame, const char *filename) |
| Publish detector results, never LOOM features or navigation evidence. | |
Variables | |
| constexpr unsigned int | sensor_width = imx500::sensor_width |
| constexpr unsigned int | sensor_height = imx500::sensor_height |
| Sensor-space height, separate from model and encoded-image dimensions. | |
| constexpr unsigned int | model_input_width = 320 |
| constexpr unsigned int | model_input_height = 320 |
| This detection head's input height; LOOM does not reuse its box semantics. | |
| constexpr uint32_t | expected_output_tensor_count = 4 |
| constexpr uint32_t | bbox_values_per_candidate = 4 |
| constexpr uint32_t | score_values_before_candidates = 4 |
| constexpr uint32_t | class_values_before_candidates = 5 |
| constexpr uint32_t | values_per_candidate_with_score_and_class = 6 |
| constexpr uint32_t | maximum_tensor_elements = IMX500_TENSOR_ELEMENT_LIMIT |
| constexpr uint32_t | maximum_tensor_dimensions = IMX500_TENSOR_MAX_RANK |
| constexpr size_t | tensor_info_header_size = IMX500_TENSOR_HEADER_BYTES |
| constexpr size_t | tensor_count_offset |
| constexpr size_t | first_tensor_record_offset |
| constexpr size_t | tensor_record_size |
| constexpr size_t | tensor_record_dimensions_offset |
| constexpr size_t | tensor_record_dimension_bytes |
| constexpr size_t | tensor_record_rank_offset |
| constexpr size_t | tensor_record_length_offset |
| constexpr size_t | tensor_info_size |
| constexpr size_t | maximum_detections = 5 |
| constexpr uint32_t | object_class_index = 0 |
| constexpr float | object_confidence_threshold = 0.6f |
Detailed Description
Internal implementation details documented here to make the camera and model contracts navigable.
Function Documentation
◆ decode()
| BasicResult spottercam::decode | ( | imx500::Span< const float > | tensor, |
| imx500::Span< const uint8_t > | info, | ||
| libcamera::Rectangle | crop, | ||
| libcamera::Size | image ) |
Validate the model's four output tensors and project object boxes into the JPEG.
- Parameters
-
tensor Interleaved boxes followed by scores, classes, and the detection count. info Driver CnnOutputTensorInfo bytes for this same camera request. crop Sensor crop reported in that request's ScalerCrop metadata. image Configured still-stream dimensions.
- Returns
- Invalid by default; valid with zero or more boxes only after full validation.
This is intentionally model-specific. Raw neural arrays cannot be treated as boxes until shape, integral count and coordinate assumptions hold.
Definition at line 146 of file spotter_cam.cpp.
◆ detector_ready()
| bool spottercam::detector_ready | ( | const imx500::FrameView & | frame | ) |
Qualify startup from a valid detector head, including zero detections.
- Parameters
-
frame Retained exposure supplied by the neutral camera worker.
- Returns
- True when this model's decoder contract holds; not necessarily a hit.
Definition at line 252 of file spotter_cam.cpp.
◆ frame_result()
| BasicResult spottercam::frame_result | ( | const imx500::FrameView & | frame | ) |
Interpret only the detector model's outputs from this retained exposure.
- Parameters
-
frame Borrowed same-exposure tensors, crop and configured image size.
- Returns
- Invalid without crop evidence, otherwise the validated detector result.
A guessed full-sensor crop could put correct boxes in the wrong JPEG position, so missing geometry is a failed analysis rather than a default.
Definition at line 241 of file spotter_cam.cpp.
◆ read_u32()
| uint32_t spottercam::read_u32 | ( | const uint8_t * | data | ) |
Decode one little-endian 32-bit integer from the driver's tensor-info byte array.
- Parameters
-
data At least four readable bytes.
- Returns
- The unsigned value represented by
data[0..3].
Definition at line 130 of file spotter_cam.cpp.
◆ write_detections()
| bool spottercam::write_detections | ( | const imx500::FrameView & | frame, |
| const char * | filename ) |
Publish detector results, never LOOM features or navigation evidence.
- Parameters
-
frame Borrowed exposure whose image/tensor identity is retained by a lease. filename New analysis destination selected by the camera publication owner.
- Returns
- True after exclusive-create, flush, sync and close; false retains no partial output.
Readiness can describe an earlier warm-up frame. Decode this frame again rather than reusing a previous result for newly captured pixels.
Definition at line 263 of file spotter_cam.cpp.
Variable Documentation
◆ bbox_values_per_candidate
|
constexpr |
Left/top/right/bottom values in each candidate.
Definition at line 66 of file spotter_cam.cpp.
◆ class_values_before_candidates
|
constexpr |
Classes follow coordinates and scores.
Definition at line 68 of file spotter_cam.cpp.
◆ expected_output_tensor_count
|
constexpr |
The model emits boxes, scores, classes, and a detection count in this order.
Definition at line 65 of file spotter_cam.cpp.
◆ first_tensor_record_offset
|
constexpr |
First record follows count.
Definition at line 81 of file spotter_cam.cpp.
◆ maximum_detections
|
constexpr |
Current single-class model contract: class zero, confidence 0.6, at most five boxes.
Definition at line 99 of file spotter_cam.cpp.
◆ maximum_tensor_dimensions
|
constexpr |
Maximum tensor rank documented by libcamera's Raspberry Pi IMX500 controls.
Definition at line 75 of file spotter_cam.cpp.
◆ maximum_tensor_elements
|
constexpr |
Maximum candidate count permitted by the model's fixed tensor scratch bound.
Definition at line 72 of file spotter_cam.cpp.
◆ model_input_height
|
constexpr |
This detection head's input height; LOOM does not reuse its box semantics.
Definition at line 62 of file spotter_cam.cpp.
◆ model_input_width
|
constexpr |
Input dimensions of the object RPK's absolute-coordinate detection head.
Definition at line 60 of file spotter_cam.cpp.
◆ object_class_index
|
constexpr |
Class selected by this detector's current model policy.
Definition at line 100 of file spotter_cam.cpp.
◆ object_confidence_threshold
|
constexpr |
Reject low-confidence boxes without invalidating the whole head.
Definition at line 101 of file spotter_cam.cpp.
◆ score_values_before_candidates
|
constexpr |
Scores follow all box coordinate values.
Definition at line 67 of file spotter_cam.cpp.
◆ sensor_height
|
constexpr |
Sensor-space height, separate from model and encoded-image dimensions.
Definition at line 58 of file spotter_cam.cpp.
◆ sensor_width
|
constexpr |
Physical IMX500 pixel-array dimensions expected by the model's coordinate transform.
Definition at line 56 of file spotter_cam.cpp.
◆ tensor_count_offset
|
constexpr |
Four-byte tensor count follows the header.
Definition at line 79 of file spotter_cam.cpp.
◆ tensor_info_header_size
|
constexpr |
Metadata layout: fixed header, tensor count, then fixed-size tensor records.
Definition at line 78 of file spotter_cam.cpp.
◆ tensor_info_size
|
constexpr |
Full IMX500 metadata structure size (16 records, each with up to 16 dimensions).
Definition at line 95 of file spotter_cam.cpp.
◆ tensor_record_dimension_bytes
|
constexpr |
Each shape entry is an unsigned 16-bit value.
Definition at line 87 of file spotter_cam.cpp.
◆ tensor_record_dimensions_offset
|
constexpr |
Length and rank occupy the first eight bytes.
Definition at line 85 of file spotter_cam.cpp.
◆ tensor_record_length_offset
|
constexpr |
Element count starts each record.
Definition at line 91 of file spotter_cam.cpp.
◆ tensor_record_rank_offset
|
constexpr |
Rank follows the four-byte element count.
Definition at line 89 of file spotter_cam.cpp.
◆ tensor_record_size
|
constexpr |
Fixed fields followed by sixteen 16-bit dimensions.
Definition at line 83 of file spotter_cam.cpp.
◆ values_per_candidate_with_score_and_class
|
constexpr |
Count follows the three candidate arrays.
Definition at line 69 of file spotter_cam.cpp.