Loading...
Searching...
No Matches
lwir_capture.c
Go to the documentation of this file.
111 const char *record_raw; /**< Raw companion path; explicit or derived `OUTPUT.raw` from native_raw. */
112 const char *gain_label; /**< Metadata label matched against the correction profile; physical gain is `--set-gain`. */
113 const char *corrections; /**< Correction profile path; must match serial/gain label/geometry. */
122 unsigned warmup_ms; /**< Startup qualification time; forced to 0 for controls and server requests. */
135 bool warn_percent_set; /**< Distinguishes an explicit `--warn-percent` from the default of 1. */
136 bool jpeg_quality_selected; /**< Rejects a repeated `--jpeg-quality`; INI may still set the base value. */
141 enum lwir_frame_layout layout; /**< Filled from the opened device; image-only cameras halve the frame size. */
163static bool select_measurement(struct capture_options *options, enum lwir_measurement_kind kind, const unsigned *coordinates);
232_Static_assert(CONFIG_FIELD_COUNT <= 64, "Configuration identities must fit the duplicate mask");
320 return ini_real(value, &options->score_threshold) && options->score_threshold >= 0 && options->score_threshold <= 1;
324 char *destination = field == CONFIG_SERIAL ? configured_serial : field == CONFIG_GAIN_LABEL ? configured_gain : configured_corrections;
325 const size_t capacity = field == CONFIG_SERIAL ? sizeof(configured_serial) : field == CONFIG_GAIN_LABEL ? sizeof(configured_gain) : sizeof(configured_corrections);
327 for (size_t index = 0; index <= strlen(value); ++index) { if (((unsigned char)value[index] < 32 && value[index]) || value[index] == 127) return false; destination[index] = value[index]; }
343 select_measurement(options, field == CONFIG_POINT ? LWIR_POINT : field == CONFIG_LINE ? LWIR_LINE : LWIR_RECTANGLE, coordinates);
345 if (field == CONFIG_WINDOW_LOW_C || field == CONFIG_WINDOW_HIGH_C || field == CONFIG_DENOISE_K ||
354 else { if (number <= 0 || number > 10) return false; options->render.denoise_raw = (unsigned)(number * 64 + 0.5); if (!options->render.denoise_raw) return false; }
365 case CONFIG_JPEG_QUALITY: if (!number || number > 100) return false; options->render.jpeg_quality = number; break;
369 case CONFIG_SCENE_CHECK: if (number > 1) return false; options->scene_check = number != 0; break;
371 case CONFIG_WARN_PERCENT: if (!number || number > 100) return false; options->warn_percent = number; options->warn_percent_set = true; break;
373 case CONFIG_AVERAGE_3X3: if (number > 1) return false; options->measurement.average_3x3 = number != 0; options->report_stats |= number != 0; break;
374 case CONFIG_ROTATE: if (number > 270 || number % 90) return false; options->render.rotation = number; break;
377 case CONFIG_DEVICE_STATE: if (number > 1) return false; options->device_state = number != 0; break;
404 if (!inference_settings_read(&model_settings, path, config_field, &parser, error, sizeof(error)) ||
406 const uint32_t window = (UINT32_C(1) << CONFIG_WINDOW_LOW_C) | (UINT32_C(1) << CONFIG_WINDOW_HIGH_C);
407 const uint32_t percentiles = (UINT32_C(1) << CONFIG_PERCENTILE_LOW) | (UINT32_C(1) << CONFIG_PERCENTILE_HIGH);
408 const uint32_t thresholds = (UINT32_C(1) << CONFIG_THRESHOLD_LOW_C) | (UINT32_C(1) << CONFIG_THRESHOLD_HIGH_C);
411 !temperature_band(parser.threshold_low_c, parser.threshold_high_c, &options->thresholds.low, &options->thresholds.high)) return false;
423 if ((parser.seen & percentiles) != percentiles || options->render.low_percentile >= options->render.high_percentile || options->render.high_percentile > 100) return false;
426 return (!options->width && !options->height) || lwir_frame_bytes(options->width, options->height) != 0;
453 fprintf(output, "%s\nUsage: lwircam [--capture] [--output FILE] [--serial SERIAL] [--size WIDTH HEIGHT]\n",
455 fprintf(output, "Model settings: --settings FILE (--config alias); analysis builds: --check-model or --analyze FILE.jpg\n");
485 "Thermal replay is marked LWIRSIM1; Tiny1C temperatures use LWIRRAW1; TDK has no thermal markers.\n");
490 "Setters require matching readback; FFC completion is not calibration validation. Never auto-retry.\n"
532static bool select_measurement(struct capture_options *options, enum lwir_measurement_kind kind, const unsigned *coordinates)
534 if (options->measurement.roi.width || options->measurement.kind != LWIR_RECTANGLE) return false;
536 options->measurement.roi = (struct lwir_roi){.x = coordinates[0], .y = coordinates[1], .width = 1, .height = 1};
565 if (errno || value > LWIR_MAX_WIDTH || (index + 1 < count ? *end != ',' : *end != '\0')) return false;
596 if ((!LWIR_ENABLE_ANALYSIS && (!strcmp(argument, "--geolocate") || !strcmp(argument, "--calibration"))) ||
597 (!LWIR_ENABLE_MOCK && (!strcmp(argument, "--mock-image") || !strcmp(argument, "--mock-layer")))) {
604 if (strcmp(name, "gain") && strcmp(name, "emissivity-128") && strcmp(name, "agc-mode") && strcmp(name, "agc")) return false;
606 /* Placeholder value only keeps the request valid: emissivity must be 1..128 even for a read. */
607 options->control = (struct lwir_control_request){.kind = !strcmp(name, "gain") ? LWIR_CONTROL_GAIN :
608 !strcmp(name, "emissivity-128") ? LWIR_CONTROL_EMISSIVITY : !strcmp(name, "agc-mode") ? LWIR_CONTROL_AGC_MODE : LWIR_CONTROL_AGC_ENABLE,
611 !strcmp(argument, "--set-agc-mode") || !strcmp(argument, "--set-agc") || !strcmp(argument, "--ffc")) {
614 if (!strcmp(argument, "--ffc")) options->control = (struct lwir_control_request){.kind = LWIR_CONTROL_FFC};
619 options->control = (struct lwir_control_request){.kind = LWIR_CONTROL_GAIN, .value = !strcmp(arguments[index], "high")};
623 options->control = (struct lwir_control_request){.kind = !strcmp(argument, "--set-emissivity-128") ? LWIR_CONTROL_EMISSIVITY :
624 !strcmp(argument, "--set-agc-mode") ? LWIR_CONTROL_AGC_MODE : LWIR_CONTROL_AGC_ENABLE, .value = (uint16_t)value};
630 if (++index >= count || !options->config || strcmp(options->config, arguments[index])) return false;
643 if (options->jpeg_quality_selected || ++index >= count || !parse_unsigned(arguments[index], 100, &options->render.jpeg_quality)
647 if (options->device_path || ++index >= count || strncmp(arguments[index], "/dev/", 5)) return false;
677 } else if (strcmp(argument, "--corrections") == 0 || strcmp(argument, "--replay-serial") == 0) {
679 const char **destination = !strcmp(argument, "--corrections") ? &options->corrections : &options->replay_serial;
684 if (++index >= count || !ini_real(arguments[index], &threshold) || threshold <= 0 || threshold > 10) return false;
695 unsigned *destination = strcmp(argument, "--warmup-ms") == 0 ? &options->warmup_ms : &options->timeout_ms;
706 if (errno || end == arguments[index] || *end || !isfinite(scaled) || scaled < 0 || scaled > 65535) return false;
729 if (++index >= count || !parse_unsigned(arguments[index], 270, &options->render.rotation) || options->render.rotation % 90) return false;
738 !temperature_band(low, high, &options->thresholds.low, &options->thresholds.high)) return false;
741 if (options->warn_percent_set || ++index >= count || !parse_unsigned(arguments[index], 100, &options->warn_percent) || !options->warn_percent) return false;
749 } else if (!strcmp(argument, "--roi") || !strcmp(argument, "--point") || !strcmp(argument, "--line")) {
750 const enum lwir_measurement_kind kind = !strcmp(argument, "--point") ? LWIR_POINT : !strcmp(argument, "--line") ? LWIR_LINE : LWIR_RECTANGLE;
766 for (const char *cursor = arguments[index]; *cursor; ++cursor) if ((unsigned char)*cursor < 32 || *cursor == 127) return false;
769 /* Allow-list: every token must be a control selector or one of its permitted companions; others abort. */
773 if (!strcmp(argument, "--set-gain") || !strcmp(argument, "--set-emissivity-128") || !strcmp(argument, "--set-agc-mode") ||
774 !strcmp(argument, "--set-agc") || !strcmp(argument, "--get-control") || !strcmp(argument, "--device") || !strcmp(argument, "--serial") || !strcmp(argument, "--timeout-ms")) {
783 /* Offline model checks/analysis never touch the camera and need the ONNX backend from settings. */
785 !options->server && !options->capture_requested && !options->raw && !options->geolocate_input &&
786 !options->mock_input && !options->device_path && !(options->inference_input && options->check_model);
804 return (options->output != NULL || options->server || options->warmup_only || options->geolocate_input != NULL || options->mock_input != NULL) &&
805 (!options->mock_input || (!options->capture_requested && !options->server && !options->warmup_only &&
808 (!options->capture_requested || options->output != NULL) && options->timeout_ms > options->warmup_ms &&
809 (!options->geolocate_input || (!options->output && !options->server && !options->warmup_only && !options->native_raw && !options->record_raw)) &&
810 (!options->warmup_only || (!options->output && !options->server && !options->record_raw && !options->native_raw)) &&
813 (options->render.view != LWIR_SENSOR || (!options->render.legend && options->render.palette == LWIR_WHITE_HOT)) &&
817 ((!options->corrections && !options->render.denoise_raw) || options->render.view != LWIR_SENSOR) &&
821 (!options->device_state || (!options->raw && !options->mock_input && !options->geolocate_input)) &&
822 (!options->device_path || (!options->raw && !options->mock_input && !options->geolocate_input)) &&
824 (options->width == 0 || lwir_measurement_valid(options->width, options->height, &options->measurement));
863 if (fstat(descriptor, &status) != 0 || !S_ISREG(status.st_mode) || status.st_size != (off_t)bytes) {
869 if (input == NULL) { const int saved_errno = errno; close(descriptor); errno = saved_errno; return false; }
881 (options->scene_check && !lwir_frame_plausible(captured_frame, bytes, options->width, options->height))) {
900 return (struct lwir_device_options){.serial = options->serial, .device_path = options->device_path,
905 .requires_thermal = options->control_selected || options->report_stats || options->thresholds.enabled || options->render.view != LWIR_SENSOR ||
927 for (size_t index = 0; index < sizeof(device_serial); ++index) device_serial[index] = device->serial[index];
948 if (!lwir_device_acquire(device, &policy, captured_frame, sizeof(captured_frame), &observation)) return false;
974 fprintf(stderr, "LWIR: read-only device state (after frame; not exposure/FFC history)\n%s", device_state_text);
1012 if (!lwir_measure_temperature(captured_frame, lwir_frame_bytes(options->width, options->height),
1018 const double variance = (double)statistics->sum_squared_raw / statistics->pixels - mean_raw * mean_raw;
1020 fprintf(stderr, "LWIR: %s %s (%zu native centers, %s): reported C min=%.3f at %u,%u max=%.3f at %u,%u mean=%.3f"
1022 options->raw ? "replay" : "camera", options->measurement.kind == LWIR_POINT ? "point" : options->measurement.kind == LWIR_LINE ? "line" : "ROI",
1030 fprintf(stderr, "LWIR: raw coverage [%.6f, %.6f] C valid=%zu below=%zu (%.3f%%) within=%zu (%.3f%%) above=%zu (%.3f%%) status=%s\n",
1032 statistics->below, statistics->below * fraction, statistics->within, statistics->within * fraction,
1034 /* Inclusive warning percentage, calculated exactly in integers; never change camera settings. */
1035 if (valid && (statistics->below * 100 >= valid * options->warn_percent || statistics->above * 100 >= valid * options->warn_percent)) {
1068 capture_evidence.serial = options->raw ? options->replay_serial : device_serial[0] ? device_serial : "unknown";
1102 fprintf(stderr, "LWIR: device gain selection conflicts with correction profile label; no publication\n");
1105 if (options->render.profile && !lwir_profile_matches(options->render.profile, options->width, options->height,
1114 const size_t bytes = lwir_frame_bytes(options->width, options->height) / (options->layout == LWIR_YUYV_IMAGE ? 2U : 1U);
1117 const bool raw_published = prepared && options->record_raw && lwir_write_raw(options->record_raw, captured_frame,
1125 fprintf(stderr, "LWIR: JPEG failed and raw companion %s could not be removed: %s\n", options->record_raw, strerror(errno));
1150 if (model_settings.backend != INFERENCE_ONNX) return model_settings.backend == INFERENCE_NATIVE;
1153 if (lwir_inference_open(&model_settings, options->score_threshold, options->class_index, error, sizeof(error))) return true;
1188 static const char *const statuses[] = {"not_requested", "ok", "unsupported", "timeout", "io_error",
1192 const bool success = options->control_read ? lwir_device_control_read(&device, options->control.kind, &result) :
1197 fprintf(stderr, "LWIR: control %s failed status=%s transport=%d device=%u submitted=%u verified=%u; %s; never retry automatically\n",
1199 result.reply.transport_error, result.reply.device_status, result.submitted ? 1U : 0U, result.verified ? 1U : 0U,
1203 if (options->control_read) printf("LWIR_CONTROL_OK control=%s operation=read value=%u\n", name, result.readback);
1204 else if (options->control.kind == LWIR_CONTROL_FFC) printf("LWIR_CONTROL_OK control=ffc operation=trigger acknowledged=1 verified=0\n");
1266 const char *profile_serial = options->raw ? options->replay_serial : device_serial[0] ? device_serial : "unknown";
1267 if (options->render.profile && !lwir_profile_matches(options->render.profile, options->width, options->height,
1269 fprintf(stderr, "LWIR: correction profile does not match this camera's serial/gain label/geometry; not ready\n");
1274 if (flags < 0 || fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK) != 0) { lwir_device_close(&session); return 1; }
1307 for (size_t index = 0; index + 1 < used; ++index) if ((unsigned char)command[index] < 32 || command[index] == 127) { result = 2; break; }
1348 if (!lwir_device_discard(&session, &discarded) || !acquire_frame(&session, options)) { result = 1; break; }
1416 fprintf(stderr, "LWIR: lifecycle cancelled/timed out; publication may be ambiguous, never retry automatically\n");
1458 struct capture_options options = {.warmup_ms = 5000, .timeout_ms = 20000, .warn_percent = 1, .score_threshold = 0.6};
1469 if (!options.config && inference_settings_find("lwircam", "lwir_cam", default_settings, sizeof(default_settings)))
1482 const bool valid = options.check_model || lwir_inference_image(options.inference_input, 1, error, sizeof(error));
1493 return lwir_process_mock(options.mock_input, options.output ? options.output : options.mock_input,
1503 /* Early, friendly refusal; the link()-based publication is the authoritative no-overwrite guard. */
1525 /* The child inherits the handlers, so both observe SIGINT/SIGTERM sent to the process group. */
1527 if (child < 0) { fprintf(stderr, "LWIR: cannot fork capture: %s\n", strerror(errno)); return 1; }
Read Linux's boot-unique identifier for pose-log session provenance.
static void usher_boot_id(char result[37])
Fill a 36-character boot UUID or the stable fallback "unknown".
Definition boot_id.h:36
Allocation-free flat key=value mechanics; callers own schemas and storage.
static bool ini_real(const char *text, double *number)
Parse finite decimal/exponent notation, rejecting range errors and suffixes.
Definition bounded_ini.h:67
static volatile sig_atomic_t interrupted
Signal-safe cancellation flag checked before blocking USB calls.
Definition chdkbridge.c:131
static uint64_t monotonic_ms(void)
Read a wall-clock-independent time base; return zero if the clock fails.
Definition chdkbridge.c:141
static bool start(uint32_t session)
Admit a nonzero session and discard correlation from the previous one.
Definition dipla_camera_backend.c:170
static uint64_t milliseconds(void)
Read elapsed-time evidence unaffected by changes to civil time.
Definition dipla_camera_backend.c:59
static int parse_unsigned(const char *text, unsigned int minimum, unsigned int maximum, unsigned int *value)
Parse a bounded unsigned command-line value.
Definition earcam.c:344
bool inference_settings_find(const char *application, const char *module, char *filename, size_t capacity)
Discover application_settings.ini in adjacent, development-module, then installed-share order.
Definition inference_settings.c:202
bool inference_settings_read(struct inference_settings *settings, const char *filename, ini_field_handler extra, void *context, char *error, size_t capacity)
Parse one flat INI, delegate application keys and resolve paths against the selected file.
Definition inference_settings.c:158
void inference_settings_init(struct inference_settings *settings, enum inference_backend backend)
Reset storage and select conservative thread/timeout defaults.
Definition inference_settings.c:28
Shared application_settings.ini discovery with module-owned extra keys.
int lwir_geolocate_image(const char *filename, const char *calibration_path)
Detect, optionally geolocate and record hotspots for one saved JPEG.
Definition lwir_analysis.c:395
Optional saved-image adapter combining thermal detection, pose and projection.
static void usage(FILE *output)
Print the build version and command-line synopsis.
Definition lwir_capture.c:451
static struct lwir_device_state captured_device_state
Definition lwir_capture.c:158
config_field
Configuration identities shared by key lookup and duplicate/pair masks.
Definition lwir_capture.c:195
static int serve_captures(struct capture_options *options)
Persistent --capture-server loop driven by USHER over stdin/stdout.
Definition lwir_capture.c:1254
static bool acquire_frame(struct lwir_device *device, const struct capture_options *options)
Acquire one frame into captured_frame and record its timing evidence.
Definition lwir_capture.c:944
static bool load_config(const char *path, struct capture_options *options)
Load the settings INI into options before command-line parsing.
Definition lwir_capture.c:399
static bool temperature_band(double low_c, double high_c, uint16_t *low_raw, uint16_t *high_raw)
Convert a Celsius band to device raw codes (Kelvin * 64).
Definition lwir_capture.c:178
static bool parse_options(int count, char **arguments, struct capture_options *options)
Apply command-line options on top of the INI settings and validate the mode.
Definition lwir_capture.c:592
static bool open_camera(struct capture_options *options, struct lwir_device *device)
Open the camera and adopt its negotiated geometry, layout and serial.
Definition lwir_capture.c:920
static bool initialize_evidence(const struct capture_options *options)
Reset the evidence record and stamp the request start time.
Definition lwir_capture.c:1059
static bool read_raw(const struct capture_options *options)
Load a replay frame into captured_frame.
Definition lwir_capture.c:857
static int supervise(pid_t child, unsigned timeout_ms)
Parent side of one-shot mode: wait for the capture child under a deadline.
Definition lwir_capture.c:1394
static bool begin_inference(const struct capture_options *options)
Open the configured inference backend, if any.
Definition lwir_capture.c:1148
static bool publish_frame(struct capture_options *options)
Validate, hash and durably publish captured_frame.
Definition lwir_capture.c:1095
static bool capture_camera(struct capture_options *options)
One-shot camera capture: open, acquire, optional state, close.
Definition lwir_capture.c:987
static int save_capture(struct capture_options *options)
Child-process body of one-shot mode: run a control or a capture.
Definition lwir_capture.c:1177
static void read_device_state(struct lwir_device *device, const struct capture_options *options)
Optionally attach read-only device state to the evidence.
Definition lwir_capture.c:967
int main(int count, char **arguments)
Program entry: select the mode, load policy and run it.
Definition lwir_capture.c:1443
static bool select_measurement(struct capture_options *options, enum lwir_measurement_kind kind, const unsigned *coordinates)
Select the single point, line or rectangle measurement.
Definition lwir_capture.c:532
static struct lwir_device_options device_policy(const struct capture_options *options)
Translate capture options into the device-layer acquisition policy.
Definition lwir_capture.c:898
static struct lwir_temperature_stats captured_statistics
Definition lwir_capture.c:157
static bool parse_coordinates(const char *text, unsigned count, unsigned *coordinates)
Parse an INI coordinate list such as x,y or x,y,w,h.
Definition lwir_capture.c:559
static void interrupt_capture(int signal_number)
SIGINT/SIGTERM handler: record the signal for cooperative cancellation.
Definition lwir_capture.c:438
static bool parse_unsigned(const char *text, unsigned maximum, unsigned *value)
Strictly parse a decimal unsigned integer with an upper bound.
Definition lwir_capture.c:505
static bool report_statistics(const struct capture_options *options)
Measure the selected region, print statistics and attach them to the evidence.
Definition lwir_capture.c:1009
Tiny1C/TDK acquisition and Tiny1C state, without image or mission logic.
bool lwir_device_discard(struct lwir_device *device, bool *received)
Drain one pending frame without retaining the borrowed UVC buffer.
Definition lwir_device_v4l2.c:1090
void lwir_device_read_state(struct lwir_device *device, struct lwir_device_state *state)
Read bounded optional state after acquisition, never writing device settings.
Definition lwir_device_v4l2.c:1319
bool lwir_device_acquire(struct lwir_device *device, const struct lwir_device_options *options, uint8_t *destination, size_t capacity, struct lwir_device_observation *observation)
Copy a qualified, fresh camera-layout frame into caller-owned storage.
Definition lwir_device_v4l2.c:963
bool lwir_device_open(struct lwir_device_options *options, struct lwir_device *device)
Open/start a bounded camera-specific combined or image-only YUY2 stream.
Definition lwir_device_v4l2.c:651
bool lwir_device_control(struct lwir_device *device, const struct lwir_control_request *request, struct lwir_control_result *result)
Submit one Tiny1-C vendor control write (or FFC action) as a standalone operation.
Definition lwir_device_v4l2.c:1289
bool lwir_device_control_read(struct lwir_device *device, enum lwir_control_kind kind, struct lwir_control_result *result)
Read the current value of one Tiny1-C control without writing it.
Definition lwir_device_v4l2.c:1300
void lwir_device_close(struct lwir_device *device)
Close an initialized session; safe repeatedly and preserves errno.
Definition lwir_device_v4l2.c:525
Positive opt-ins shared by the worker and its USHER adapter.
#define LWIR_ENABLE_MOCK
1 builds the development replay/synthetic-temperature adapter (lwir_mock).
Definition lwir_features.h:32
#define LWIR_ENABLE_ANALYSIS
1 builds the optional ONNX analysis of saved photos (lwir_inference).
Definition lwir_features.h:28
bool lwir_measurement_valid(unsigned width, unsigned height, const struct lwir_measurement *measurement)
Validate a measurement request against native geometry.
Definition lwir_frame.c:84
bool lwir_measure_temperature(const uint8_t *frame, size_t bytes, unsigned width, unsigned height, const struct lwir_measurement *measurement, const struct lwir_thresholds *thresholds, struct lwir_temperature_stats *statistics)
Measure a point, line or rectangle in native coordinates.
Definition lwir_frame.c:326
bool lwir_frame_valid(const uint8_t *frame, size_t bytes, unsigned width, unsigned height)
Structural check: non-NULL, supported geometry, exact combined size.
Definition lwir_frame.c:420
bool lwir_frame_plausible(const uint8_t *frame, size_t bytes, unsigned width, unsigned height)
Conservative scene-plausibility heuristic.
Definition lwir_frame.c:465
size_t lwir_frame_bytes(unsigned width, unsigned height)
Combined frame size for supported geometry.
Definition lwir_frame.c:56
Native frame arithmetic and camera measurements; no codec or flight dependencies.
lwir_measurement_kind
Ordinary camera measurements, independent of optional hotspot analysis.
Definition lwir_frame.h:69
lwir_frame_layout
Buffer content kinds: full image+thermal frame, or the YUYV image plane alone.
Definition lwir_frame.h:54
#define LWIR_MAX_FRAME_BYTES
Largest combined frame: two planes of 2 bytes per pixel.
Definition lwir_frame.h:51
bool lwir_write_raw(const char *path, const uint8_t *frame, size_t bytes, unsigned width, unsigned height)
Publish the combined frame verbatim; see lwir_image.h.
Definition lwir_image.c:516
bool lwir_write_jpeg_rendered(const char *path, const uint8_t *frame, size_t bytes, unsigned width, unsigned height, bool synthetic, const struct lwir_evidence *evidence, const struct lwir_render_options *render)
Publish a rendered view with provenance; see lwir_image.h.
Definition lwir_image.c:522
bool lwir_remove_published(const char *path)
Remove a file this process published and persist the removal; see lwir_image.h.
Definition lwir_image.c:488
const char * lwir_jpeg_provider(void)
Report the bundled codec; see lwir_image.h.
Definition lwir_image.c:380
JPEG encoding and durable no-overwrite publication of LWIR frames.
void lwir_inference_close(void)
Release the classifier; harmless when not open. Threshold/category are reset by the next open.
Definition lwir_inference.c:139
bool lwir_inference_image(const char *filename, unsigned long long sequence, char *error, size_t capacity)
Classify one saved photo and publish its evidence sidecar.
Definition lwir_inference.c:83
bool lwir_inference_open(const struct inference_settings *settings, double threshold, unsigned category, char *error, size_t capacity)
Open and qualify the LWIR classifier (see lwir_inference.h).
Definition lwir_inference.c:49
Optional serialized LWIR model adapter, separate from USB capture and calibration.
int lwir_process_mock(const char *input_path, const char *output_path, bool layer_only)
Produce mock LWIR evidence from input_path at output_path.
Definition lwir_mock.c:208
Optional development replay adapter, independent of geographic analysis.
bool lwir_profile_load(const char *path, struct lwir_profile *profile)
Load and fully validate a profile; see lwir_render.h.
Definition lwir_profile.c:137
bool lwir_profile_matches(const struct lwir_profile *profile, unsigned width, unsigned height, const char *serial, const char *gain)
Exact match of geometry, serial and gain label; see lwir_render.h.
Definition lwir_profile.c:178
Display rendering of Tiny1-C frames into JPEG-ready Y/Cb/Cr scanlines.
bool lwir_state_u16(const struct lwir_device_state *state, enum lwir_state_field field, uint16_t *value)
Decode a validated big-endian two-byte snapshot field.
Definition lwir_state.c:412
size_t lwir_state_format(const struct lwir_device_state *state, char *output, size_t capacity)
Render snapshot evidence as key=value lines for the JPEG APP14 segment.
Definition lwir_state.c:430
bool lwir_control_valid(const struct lwir_control_request *request)
Range-check a control request (vendor-header limits).
Definition lwir_state.c:231
Build-version string exported by the standalone LWIR application.
#define LWIRCAM_BUILD_VERSION
Human-readable identity, e.g. "LWIRcam 1.0.0 (Git unknown)", built by literal concatenation.
Definition version.h:34
void sha256_hex(const void *data, size_t length, char *output)
Hash one memory region to a lowercase hexadecimal string.
Definition sha256fst.c:272
Allocation-free, portable SHA-256 checksums for memory and streams.
Effective run policy: INI settings first, then command-line overrides.
Definition lwir_capture.c:106
Per-application configuration; all resolved paths belong to this caller-owned value.
Definition inference_settings.h:39
One requested setting change; validate with lwir_control_valid().
Definition lwir_state.h:181
Outcome of lwir_state_control() or lwir_state_control_read().
Definition lwir_state.h:195
Host observation plus optional kernel clock evidence, never automatic exposure qualification.
Definition lwir_device.h:163
unsigned kernel_timestamp_flags
Definition lwir_device.h:173
uint64_t kernel_monotonic_us
Definition lwir_device.h:170
Bounded camera policy; Tiny1C requires full 256x192 image and temperature planes.
Definition lwir_device.h:93
One post-capture snapshot of all lwir_state_field values.
Definition lwir_state.h:135
Borrowed provenance for one publication; strings must outlive encoding.
Definition lwir_image.h:63
Measured display-correction profile for one camera, gain label and geometry.
Definition lwir_render.h:70
Display policy for one rendering request; never affects stored samples.
Definition lwir_render.h:103
Native rectangle; a zero width/height pair selects the full image.
Definition lwir_frame.h:61
Raw-unit measurement results; derive mean/variance from the sums and pixels.
Definition lwir_frame.h:98
Optional coverage band counted alongside measurement statistics.
Definition lwir_frame.h:89