Native USHER adapter for on-sensor detection or photo-only capture. More...
#include <stddef.h>#include <stdbool.h>#include <stdint.h>

Go to the source code of this file.
Data Structures | |
| struct | spotter_detection |
| struct | spotter_detections |
Macros | |
| #define | SPOTTER_MAX_DETECTIONS 64U |
| #define | SPOTTER_LABEL_CAPACITY 64U |
Functions | |
| bool | spotter_cam_pipe_read_detections (const char *filename, struct spotter_detections *detections) |
| Read the full detector result associated with a JPEG. | |
| void | spotter_cam_pipe_configure (const struct camera_backend_host *host) |
| Borrow USHER's shutdown flag for both serialized native worker owners. | |
| int | spotter_cam_pipe_set_photo_only (bool enabled) |
| Select or inspect the model-free capture mode before worker startup. | |
| bool | spotter_cam_pipe_photo_only (void) |
| Report whether capture was configured without analysis. | |
| int | spotter_cam_pipe_init (const char *unused) |
| Start and qualify native persistent capture with the selected analysis policy. | |
| void | spotter_cam_pipe_set_photo_directory (const char *directory) |
| Set the borrowed output directory before backend initialization. | |
| int | spotter_cam_pipe_shoot (char *filename, size_t filename_size, int image_number) |
| Request one JPEG and, when enabled, parse its matching detection sidecar. | |
| void | spotter_cam_pipe_deinit (void) |
| Stop the native camera process and clear detector-specific configuration. | |
| void | spotter_cam_pipe_last_detection_summary (char *buffer, size_t buffer_size) |
| Format the most recent shot's detection result for EXIF writing. | |
| bool | spotter_cam_pipe_bind_frame (uint64_t sequence, uint64_t sensor_timestamp_ns) |
| Reject a detection result whose identity differs from the validated saved frame. | |
| void | spotter_cam_pipe_save_detection_copy (const char *filename) |
Copy filename into a "detections" subdirectory of the photo directory if the last spotter_cam_pipe_shoot() call found an object. | |
| int | spotter_cam_pipe_set_settings (const char *settings) |
| Select the detector assignment before either capture or saved-picture analysis starts. | |
| int | spotter_cam_pipe_analyze (const char *filename, unsigned number) |
| Analyze a saved simulation/private picture and bind results to its source hash and request. | |
Detailed Description
Native USHER adapter for on-sensor detection or photo-only capture.
Uses the neutral native-worker supervisor, then interprets only the matching detector sidecar. Capture success and usable analysis are separate outcomes; the last result is retrieved separately for EXIF.
- Precondition
- Configuration, capture, binding and result retrieval are serialized by the owning backend. This adapter has one parser workspace and one last result.
Definition in file spotter_cam_pipe.h.
Macro Definition Documentation
◆ SPOTTER_LABEL_CAPACITY
| #define SPOTTER_LABEL_CAPACITY 64U |
Definition at line 38 of file spotter_cam_pipe.h.
◆ SPOTTER_MAX_DETECTIONS
| #define SPOTTER_MAX_DETECTIONS 64U |
Definition at line 37 of file spotter_cam_pipe.h.
Function Documentation
◆ spotter_cam_pipe_analyze()
| int spotter_cam_pipe_analyze | ( | const char * | filename, |
| unsigned | number ) |
Analyze a saved simulation/private picture and bind results to its source hash and request.
- Parameters
-
filename Saved JPEG, still owned by the producer during analysis. number Positive increasing correlation number.
- Returns
- Zero when disabled or a matching result is accepted, minus one with retained detections cleared.
A valid empty result remains distinct from failed or mismatched analysis.
Definition at line 546 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_bind_frame()
| bool spotter_cam_pipe_bind_frame | ( | uint64_t | sequence, |
| uint64_t | sensor_timestamp_ns ) |
Reject a detection result whose identity differs from the validated saved frame.
- Parameters
-
sequence Camera sequence obtained from that image's validated frame evidence. sensor_timestamp_ns Matching sensor timestamp, not the FC shot time.
- Returns
- True for matching detector identity; false clears the retained analysis.
INI parsing alone does not bind detections to pixels. Compare both fields after shared frame/file validation and before EXIF replacement changes the inode.
Definition at line 351 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_configure()
| void spotter_cam_pipe_configure | ( | const struct camera_backend_host * | host | ) |
Borrow USHER's shutdown flag for both serialized native worker owners.
Definition at line 110 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_deinit()
| void spotter_cam_pipe_deinit | ( | void | ) |
Stop the native camera process and clear detector-specific configuration.
Stop the selected camera owner and release detector-specific configuration.
Definition at line 532 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_init()
| int spotter_cam_pipe_init | ( | const char * | unused | ) |
Start and qualify native persistent capture with the selected analysis policy.
- Parameters
-
unused Reserved common backend argument.
- Returns
- 0 after the selected producer qualifies readiness, otherwise -1.
Process startup alone is insufficient: the capture owner must report its initial frame and, when enabled, inference contract before accepting photographs.
Definition at line 496 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_last_detection_summary()
| void spotter_cam_pipe_last_detection_summary | ( | char * | buffer, |
| size_t | buffer_size ) |
Format the most recent shot's detection result for EXIF writing.
- Parameters
-
buffer Caller-owned destination for a short human-readable summary. buffer_size Capacity of buffer.
Reflects the last spotter_cam_pipe_shoot() call only; safe to call even when that call failed (reports status=analysis_failed) or no server ever ran.
Definition at line 374 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_photo_only()
| bool spotter_cam_pipe_photo_only | ( | void | ) |
Report whether capture was configured without analysis.
- Returns
- True in photo-only mode.
This is a configuration check, not a camera readiness check.
Definition at line 126 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_read_detections()
| bool spotter_cam_pipe_read_detections | ( | const char * | filename, |
| struct spotter_detections * | detections ) |
Read the full detector result associated with a JPEG.
- Parameters
-
filename JPEG paired with the sidecar. [out] detections Required destination for boxes and provenance.
- Returns
- True for a valid sidecar, including an empty detector result.
Use the same validation as the capture summary so downstream projection cannot admit results the capture pipeline rejects.
Definition at line 345 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_save_detection_copy()
| void spotter_cam_pipe_save_detection_copy | ( | const char * | filename | ) |
Copy filename into a "detections" subdirectory of the photo directory if the last spotter_cam_pipe_shoot() call found an object.
- Parameters
-
filename Path to the just-finished image (ideally already EXIF-tagged by the caller, so the copy carries the same metadata as the original).
No-op when the last shot found nothing, never completed, or filename is NULL/empty; safe to call unconditionally, mirroring spotter_cam_pipe_last_detection_summary().
Definition at line 459 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_set_photo_directory()
| void spotter_cam_pipe_set_photo_directory | ( | const char * | directory | ) |
Set the borrowed output directory before backend initialization.
- Parameters
-
directory Caller-owned path retained until configuration changes; NULL restores the build-time default.
- Precondition
- No capture is using the previous configuration.
Definition at line 367 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_set_photo_only()
| int spotter_cam_pipe_set_photo_only | ( | bool | enabled | ) |
Select or inspect the model-free capture mode before worker startup.
Definition at line 116 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_set_settings()
| int spotter_cam_pipe_set_settings | ( | const char * | settings | ) |
Select the detector assignment before either capture or saved-picture analysis starts.
- Parameters
-
settings Nonempty borrowed application settings path, alive until both workers stop.
- Returns
- Zero if accepted; minus one for invalid input or an already active worker.
Definition at line 539 of file spotter_cam_pipe.c.
◆ spotter_cam_pipe_shoot()
| int spotter_cam_pipe_shoot | ( | char * | filename, |
| size_t | filename_size, | ||
| int | image_number ) |
Request one JPEG and, when enabled, parse its matching detection sidecar.
- Parameters
-
filename Output path buffer, cleared on failure. filename_size Output path capacity. image_number USHER shot sequence.
- Returns
- 0 only for a qualified saved image, otherwise -1.
Missing or malformed analysis leaves the photograph usable and makes the summary report analysis_failed. Clearing the old result prevents a previous hit being attached to the next exposure.
Definition at line 510 of file spotter_cam_pipe.c.