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
imx500 Namespace Reference

Namespaces

namespace  detail

Data Structures

struct  FrameView
 Borrowed same-exposure evidence, without object or navigation semantics. More...
struct  FrameProcessor
 Stack-owned model-specific operations; no dynamic plugin allocation. More...
class  FrameLease
 Exactly-once release of a borrowed frame, including exception exits. More...
class  Camera
 One exclusive IMX500 owner with bounded reusable YUV420 buffers. More...

Functions

static bool encode_frame_jpeg (const char *path, const std::array< const uint8_t *, 3 > &planes, unsigned width, unsigned height, unsigned stride, const FrameView *view, const FrameProcessor *processor)
 Encode one YUV420 frame with optional same-exposure EXIF metadata.
bool encode_jpeg (const char *path, const std::array< const uint8_t *, 3 > &planes, unsigned width, unsigned height, unsigned stride)
 Encode validated YUV420 planes directly, without full-frame RGB staging.
bool publish_frame (const FrameView &frame, const std::array< const uint8_t *, 3 > &planes, unsigned stride, const char *filename, const FrameProcessor &processor)
 Publish caller-validated YUV420 planes and same-exposure evidence.
int run_worker (int argc, char **argv, const FrameProcessor &processor, const char *application)
 Run the shared probe/capture/READY-SHOT-OK worker with supplied model policy.
int run_photo_worker (int argc, char **argv, const char *application)
 Run photo-only probe, capture or serve without model loading or inference.
constexpr bool valid_capture_dimensions (unsigned width, unsigned height)
 Check that capture dimensions meet the worker's raster policy.

Variables

constexpr unsigned sensor_width = 4056
 Physical IMX500 array width, used to reject an unexpected sensor geometry.
constexpr unsigned sensor_height = 3040
 Physical IMX500 array height; model input dimensions are separate policy.

Function Documentation

◆ encode_frame_jpeg()

bool imx500::encode_frame_jpeg ( const char * path,
const std::array< const uint8_t *, 3 > & planes,
unsigned width,
unsigned height,
unsigned stride,
const FrameView * view,
const FrameProcessor * processor )
static

Encode one YUV420 frame with optional same-exposure EXIF metadata.

Parameters
pathNew output path; exclusive creation never replaces an existing file.
planesBorrowed Y, Cb and Cr starts, readable throughout encoding.
widthPositive even image width in pixels.
heightPositive even image height in pixels.
strideEven luma byte stride; chroma uses half this stride.
viewCapture evidence to embed, or NULL for a pixels-only JPEG.
processorOptional application callback for extending the EXIF document.
Returns
True after encoding, flushing, file sync and close; false on metadata rejection or I/O/codec failure. Partial files created here are removed.
Precondition
The caller has validated dimensions, strides and accessible plane lengths.

Metadata is prepared before opening the output or entering libjpeg's C error boundary, so a throwing embed callback leaves no partial JPEG behind.

Definition at line 278 of file imx500_camera.cpp.

◆ encode_jpeg()

bool imx500::encode_jpeg ( const char * path,
const std::array< const uint8_t *, 3 > & planes,
unsigned width,
unsigned height,
unsigned stride )

Encode validated YUV420 planes directly, without full-frame RGB staging.

Use the same encoder without capture/application metadata so pixels-only callers retain identical YUV layout and output-cleanup behavior.

Parameters
pathNew output path; exclusive creation refuses overwrites.
planesAccessible Y, Cb and Cr plane starts, immutable during encoding.
widthPositive even image width in pixels.
heightPositive even image height in pixels.
strideEven luma byte stride, at least the width rounded up to 16; chroma uses half.
Returns
True after encoding, flush, file sync and close; false removes partial output.
Precondition
The caller has checked plane lengths and image/stride layout. This low-level encoder does not accept arbitrary unchecked external plane pointers.

Definition at line 359 of file imx500_camera.cpp.

◆ publish_frame()

bool imx500::publish_frame ( const FrameView & view,
const std::array< const uint8_t *, 3 > & planes,
unsigned stride,
const char * filename,
const FrameProcessor & processor )

Publish caller-validated YUV420 planes and same-exposure evidence.

Encode first, then attempt sidecar output, then link the complete JPEG into place. The JPEG is the final publication step, but JPEG and sidecar are not one atomic transaction; callbacks must remove their own partial outputs.

Exceptions
std::exceptionFilesystem or processor exceptions propagate after cleanup.
Parameters
viewBorrowed evidence belonging to the supplied pixels.
planesAccessible YUV420 planes retained by the caller.
strideLuma byte stride; chroma uses half this stride.
filenameNew absolute JPEG destination.
processorApplication's trusted sidecar suffix and writer callbacks.
Returns
True when the JPEG is published, regardless of missing analysis; false when publication fails. File/processor exceptions may also propagate.
Precondition
Plane spans cover the declared image/stride and remain immutable for this call. Capture retains its frame lease while invoking this routine.

Analysis failure retains a usable photograph. Publication failure removes successfully created sidecars from this operation, never an existing image.

Warning
JPEG and sidecars are not one filesystem transaction. Consumers must check file/exposure identity, and directory power-loss durability is not guaranteed.

Definition at line 712 of file imx500_camera.cpp.

◆ run_photo_worker()

int imx500::run_photo_worker ( int argc,
char ** argv,
const char * application )

Run photo-only probe, capture or serve without model loading or inference.

Parameters
argcArgument count for the photo-only command.
argvCommand and mode-specific dimensions or destination.
applicationDiagnostic prefix.
Returns
Zero for success, two for invalid arguments, one for runtime failure.

Definition at line 931 of file imx500_camera.cpp.

◆ run_worker()

int imx500::run_worker ( int argc,
char ** argv,
const FrameProcessor & processor,
const char * application )

Run the shared probe/capture/READY-SHOT-OK worker with supplied model policy.

Return values
0Probe/capture succeeded, or the serving input ended cleanly.
1Runtime, output or protocol-stream I/O failure.
2Invalid arguments, dimensions, processor contract or command syntax.

A per-SHOT save failure emits ERROR without retrying the exposure. An exception terminates the worker after reporting the reason on stderr.

Parameters
argcArgument count for a capture mode, excluding saved-photo matcher modes.
argvMode, RPK and mode-specific dimensions/destination tokens.
processorReadiness and sidecar callbacks; never interpreted as navigation here.
applicationDiagnostic prefix selected by the independent entry point.
Returns
Zero for success, two for syntax/configuration misuse, one for runtime failure.

The worker announces READY after a fresh frame and, for detection, model-specific validation. Every SHOT leases a new exposure without replay. Standard output is protocol-only while diagnostics go to standard error.

Definition at line 817 of file imx500_camera.cpp.

◆ valid_capture_dimensions()

bool imx500::valid_capture_dimensions ( unsigned width,
unsigned height )
constexpr

Check that capture dimensions meet the worker's raster policy.

Parameters
widthRequested columns.
heightRequested rows.
Returns
True for an even raster within the physical array and minimum dimensions.

Check here before driver setup; this does not guarantee that the driver will accept a specific format or stream configuration.

Definition at line 68 of file imx500_camera.hpp.

Variable Documentation

◆ sensor_height

unsigned imx500::sensor_height = 3040
constexpr

Physical IMX500 array height; model input dimensions are separate policy.

Definition at line 60 of file imx500_camera.hpp.

◆ sensor_width

unsigned imx500::sensor_width = 4056
constexpr

Physical IMX500 array width, used to reject an unexpected sensor geometry.

Definition at line 58 of file imx500_camera.hpp.