Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
lwir_spotter.c File Reference

Associate detections with the native thermal samples of a saved LWIR frame. More...

#include "lwir_spotter.h"
#include "spotter_cam_pipe.h"
#include "imx500_pipe.h"
#include "camera_profile.h"
#include "bounded_ini.h"
#include "lwir_container.h"
#include "lwir_render.h"
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for lwir_spotter.c:

Go to the source code of this file.

Macros

#define USHER_SPOTTERCAM_COMMAND   "./bin/spottercam"

Functions

bool lwir_spotter_settings (const char *settings)
 Select a separate ONNX detector assignment.
bool lwir_spotter_profile (const char *filename)
 Load a native LWIR intrinsics and mount profile.
bool lwir_spotter_limits (const char *limits)
 Set the timing and pose uncertainty limits for projection.
bool lwir_spotter_enabled (void)
 Test whether saved-LWIR analysis was explicitly selected.
void lwir_spotter_stop (void)
 Stop the exclusively owned model worker.
static bool same_file (const struct stat *before, const struct stat *after)
 Check whether an image still matches its pre-analysis metadata.
int lwir_spotter_analyze (const char *filename, const union dc_shot_union *shot, const struct capture_timing *timing, const volatile sig_atomic_t *running)
 Analyse one immutable image with copied capture evidence; no camera is acquired.

Variables

static struct imx500_pipe analysis = IMX500_PIPE_INITIALIZER
static const char * selected_settings
static struct usher_camera_profile profile
static bool profile_loaded
static unsigned request_sequence
static uint64_t maximum_interval_us = 5000
static double maximum_uncertainty_m = 1.0
static uint8_t combined [256U *192U *4U]
static struct spotter_detections detections

Detailed Description

Associate detections with the native thermal samples of a saved LWIR frame.

Reuse the Spottercam analysis worker on already-published captures. Keep display coordinates, native sensor coordinates, and optional geographic estimates distinct. The image is checked again before the sidecar is published so a replaced capture is not silently paired with another frame's detections.

Definition in file lwir_spotter.c.

Macro Definition Documentation

◆ USHER_SPOTTERCAM_COMMAND

#define USHER_SPOTTERCAM_COMMAND   "./bin/spottercam"

Definition at line 43 of file lwir_spotter.c.

Function Documentation

◆ lwir_spotter_analyze()

int lwir_spotter_analyze ( const char * filename,
const union dc_shot_union * shot,
const struct capture_timing * timing,
const volatile sig_atomic_t * running )

Analyse one immutable image with copied capture evidence; no camera is acquired.

Caller serializes calls. Geographic results require qualified exposure timing and pose; an unavailable position never invalidates a good image result.

Parameters
filenamePath to the published LWIR JPEG with embedded thermal evidence.
shotCapture trigger carrying the photo number.
timingFrame delivery and optional exposure/pose evidence for this image.
runningCancellation flag passed to the subprocess wrapper.
Returns
Zero for disabled or successful analysis, minus one on failure.

Definition at line 118 of file lwir_spotter.c.

◆ lwir_spotter_enabled()

bool lwir_spotter_enabled ( void )

Test whether saved-LWIR analysis was explicitly selected.

Returns
True if a settings path has been selected.

This reports configuration, not worker readiness or model validity.

Definition at line 91 of file lwir_spotter.c.

◆ lwir_spotter_limits()

bool lwir_spotter_limits ( const char * limits)

Set the timing and pose uncertainty limits for projection.

Parameters
limitsComma-separated maximum exposure interval in microseconds and maximum pose uncertainty in metres.
Returns
True if both positive bounds were accepted.

Apply both limits together after parsing, before the worker starts. They constrain geographic estimates, not pixel-space detection.

Definition at line 74 of file lwir_spotter.c.

◆ lwir_spotter_profile()

bool lwir_spotter_profile ( const char * profile)

Load a native LWIR intrinsics and mount profile.

Parameters
profilePath of the camera profile to read.
Returns
True if an LWIR profile with 256 by 192 calibration was loaded.

Validate a candidate before replacing the current profile. A profile cannot be replaced while the analysis worker is live.

Definition at line 63 of file lwir_spotter.c.

◆ lwir_spotter_settings()

bool lwir_spotter_settings ( const char * settings)

Select a separate ONNX detector assignment.

Parameters
settingsBorrowed settings path; keep it valid while analysis is enabled.
Returns
True if the path was accepted; false for an empty path or a live worker.

Store the selection without starting a worker. The first analysis request loads the assignment.

Definition at line 56 of file lwir_spotter.c.

◆ lwir_spotter_stop()

void lwir_spotter_stop ( void )

Stop the exclusively owned model worker.

Call after the analysis owner has joined. Stopping the process does not clear the selected settings.

Definition at line 96 of file lwir_spotter.c.

◆ same_file()

bool same_file ( const struct stat * before,
const struct stat * after )
static

Check whether an image still matches its pre-analysis metadata.

Parameters
beforeMetadata captured before reading the image.
afterMetadata captured after a later processing step.
Returns
True if the later file is regular and the identity and metadata match.

Device and inode catch replacement; size, modification time and change time detect ordinary in-place edits without rereading the image. This check is not a content hash.

Definition at line 110 of file lwir_spotter.c.

Variable Documentation

◆ analysis

struct imx500_pipe analysis = IMX500_PIPE_INITIALIZER
static

Definition at line 46 of file lwir_spotter.c.

◆ combined

uint8_t combined[256U *192U *4U]
static

Definition at line 53 of file lwir_spotter.c.

◆ detections

struct spotter_detections detections
static

Definition at line 54 of file lwir_spotter.c.

◆ maximum_interval_us

uint64_t maximum_interval_us = 5000
static

Definition at line 51 of file lwir_spotter.c.

◆ maximum_uncertainty_m

double maximum_uncertainty_m = 1.0
static

Definition at line 52 of file lwir_spotter.c.

◆ profile

struct usher_camera_profile profile
static

Definition at line 48 of file lwir_spotter.c.

◆ profile_loaded

bool profile_loaded
static

Definition at line 49 of file lwir_spotter.c.

◆ request_sequence

unsigned request_sequence
static

Definition at line 50 of file lwir_spotter.c.

◆ selected_settings

const char* selected_settings
static

Definition at line 47 of file lwir_spotter.c.