How does EIP decouple acquisition, processing, recording and web serving while preserving a single timeline for all frames?
Purpose, question and scope
This article describes Embedded Imaging Platform as of 5 October 2026. It draws on the code, architecture documentation, archived performance measurements and the Git history of this repository, which begins with the first commit of this new version on 14 August 2026. Line counts describe the software's scale and growth, not its quality.
I first imagined PolarScope in 2019 as a digital polar scope for my Takahashi EM-10 astronomy mount; my notes on that prototype, built with a Raspberry Pi camera and Pi Zero, also document calibration and stellar correlation tests. This unfinished first version became the basis of the 2026 version that would lead to EIP.
The printed holder adapted a CS lens to the camera and allowed it to be mounted on the EM-10. The exploded view below documents this early prototype's mechanical design and test holder before adaptation to the mount.
EIP is a C++17 embedded imaging server accompanied by web applications and a secondary native client. It handles acquisition, raw sensor data (RAW) transport, previews, recording, storage, telemetry, astronomy and sensor characterisation.
Architectural invariant: one owner, a modular monolith
The main deployment uses a process named imaging-server. This gives the hardware a single owner, avoids interprocess frame serialisation and keeps the metadata on the same timeline as the pixels. The code remains organised into modules with distinct responsibilities.
Dependencies follow four layers:
The dependency direction is Applications → Astronomy → Imaging core → Drivers. Not every application uses the astronomy services. Drivers follow a common interface and publish their capabilities; the server therefore assumes neither a particular sensor family nor a single RAW bit depth.
Development recorded in Git
| Date | Stage | Architectural consequence |
|---|---|---|
| 14–17 August | In-memory libcamera, continuous acquisition, asynchronous client | The sensor's frame rate is no longer tied to the display loop. |
| 19 August | Client/server separation | The camera protocol becomes generic. |
| 24–29 August | Web control, MJPEG, asynchronous analysis, double buffering | The browser becomes a full client without blocking acquisition. |
| 17–23 September | PiNox, Dashboard, portal and EIP configuration | The initial project evolves into a generic foundation for multiple applications. |
| 25 September | Compiled interfaces and PIMPL | Reduced coupling and recompilation cost on smaller Pi models. |
| 28 September | Consolidation of imaging, storage and files | High-rate local capture joins the shared portal. |
| 29 September–1 October | Measured ISP path | The backend can produce paired RAW and RGB outputs with software fallback. |
| 2–5 October | In-memory C++ characterisation | Acquisition, analysis and reporting are integrated into the same server. |
Data plane and control plane
Communication with the server is divided into two planes. The data plane transports images through the endpoints /snapshot/raw, /stream/raw, /stream.mjpg and /preview.png, and handles local AVI, SER or PNG writing. The control plane uses structured responses for settings, telemetry and module status.
This separation avoids using the compressed preview as a scientific source. In full-resolution IMX477 mode, measured HTTP RAW throughput tops out at around 105 to 115 MB/s even though capture can be faster. The local recording path therefore branches off before the network.
The frame lifecycle and shared processing
- The driver acquires the memory buffer and sensor metadata.
- The producer publishes a frame snapshot identified by
frame_id. - RAW data can be transmitted, analysed or queued for recording without an intermediate file.
- The preview selects raw, luminance or colour rendering and applies the requested reduction.
- Luminance, work buffers and the encoded JPEG are cached for that frame.
- Each client receives at most one MJPEG part for that frame identifier.
With the libcamera backend and image signal processor (ISP) active, the RAW data and red-green-blue (RGB) output of the hardware chain come from the same request. Scientific processing continues to use RAW; the colour output is only the starting point for the preview.
Execution domains, queues and buffers
Several execution threads handle the server's tasks. Depending on configuration, the arrangement includes:
- the backend capture thread and the server's frame producer;
- one thread per accepted HTTP connection;
- threads for annotation, atmospheric dispersion and tracking a region of interest;
- the RAW recorder's asynchronous writer thread;
- idle monitoring, logging and characterisation tasks;
- occasional storage throughput tests or communication between EIP instances.
Per-pixel operations use OpenMP (Open Multi-Processing, a parallel programming interface) above a size threshold so that scheduling and synchronisation overhead do not exceed the expected benefit of parallel work.
The plate solver can search for a field without knowing its centre, provided it has an approximate angular sampling value. It tests different catalogue regions; valid observer position and time allow a horizon filter to narrow the search. It also uses OpenMP, with at most four computing threads and one core left available when multiple cores are reported. The search therefore retains these prior inputs even without a known initial centre.
This architecture uses locks, condition variables and protected queues. These mechanisms aim to decouple processing rates: slow writing or expensive analysis should not force the camera to run at the same slower rate.
Write queues, buffers and overload
The recorder receives a reference to the RAW payload and passes it to a dedicated writer thread. Its queue is bounded by a memory budget; normal shutdown drains it before closing the container, whereas an explicit abort accounts for rejected frames. This distinction avoids silently producing an incomplete file.
The preview uses double buffering: while frame N's JPEG is encoded, frame N+1 can be prepared. The current frame, JPEG and intermediate buffers are reused to limit allocations, copies and swapping on Pi Zero.
Shared cache and analysis rate
The cache is indexed by source identity and parameters that affect rendering. JPEG is not re-encoded for each browser. Bayer-cell luminance can be shared between video and overlay annotations. When analysis of an empty sky produces no useful change, its rate can fall to roughly one analysis per second to preserve video performance.
The 23 September fix also requires waiting for a new frame. Previously, a loop faster than the camera could resend the same JPEG several times. After the fix, IMX477 measurements at 1332 × 990 show 47.7 captured frames, 47.7 RAW frames and 47.7 distinct MJPEG frames per second, with 0% duplicates.
Measured performance: double buffering and ISP
The 29 August performance test uses an OV5647, a 20 ms exposure and gain 8. It counts distinct JPEG images without confusing HTTP repeats with new frames.
| Platform and mode | Rendering | Before | After | Gain |
|---|---|---|---|---|
| Pi 4, bin2 | Colour | 31.1 FPS | 45.4 FPS | +46% |
| Pi 4, bin2 | Colour + white balance | 31.2 FPS | 45.4 FPS | +45% |
| Pi Zero 2 W, bin2 | Luminance | 16.5 FPS | 27.2 FPS | +65% |
| Pi Zero 2 W, bin2 | Colour | 11.2 FPS | 19.2 FPS | +71% |
| Pi Zero 2 W, bin2 | Colour + white balance | 11.2 FPS | 19.3 FPS | +72% |
On Pi 4 in bin1 mode, frame rate stays close to 15 FPS before and after: sensor readout is the limiting factor.
ISP integration
The ISP path introduces hardware acceleration without changing the core's contract. The choice of auto, software or isp belongs to preview settings. A neutralised settings profile must be available and validated for the sensor; otherwise automatic mode falls back to software and reports why.
On IMX477/Pi 4 at 4056 × 3040, measured frame rate stays near 11.2 FPS, limited by acquisition, while process load falls from 232.6% to 93.4% and latency from 55.7 to 40.2 ms. On OV5647/Pi 3 at 2592 × 1944, frame rate rises from 12.80 to 14.92 FPS, CPU load falls from 299.0% to 113.7%, and latency from 72.8 to 42.2 ms.
Modularisation and compilation cost
The original server was largely defined in header files. A change could force much of the project to be recompiled and sharply increase compiler memory use, which is costly on Pi Zero. The 25 September restructuring moves implementations into .cpp files, reduces transitive includes and hides substantial implementation details behind PIMPL interfaces.
HTTP transport, web resources, camera settings, drivers, RAW recording, monitoring, catalogues, solvers, image operations and application modules have been separated. The HTTP server still carries substantial orchestration responsibility: some functions remain to be extracted.
Growth in code volume
The series uses twelve snapshots of the latest commit available at the end of each date. Production scope is limited to C/C++, JavaScript, CSS and HTML files under src/ and assets/web/. Test scope includes C/C++, JavaScript and shell sources under tests/. Blank lines are removed. Exclusions include documentation, the editorial site web/, databases, catalogues, scientific data, figures, dependencies, benchmarks, deployment scripts and one-off tools.
Within this scope, production code grows by a factor of 7.45 and software plus tests by 9.27 in 52 days. Tests account for 21.5% of the final total. These ratios describe repository growth; they are not measures of maintainability or quality.
Resilience and embedded operation
The server monitors capture stalls, limits MJPEG streams per address, separates idle handling from long exposures and can keep acquisition running during operations that prevent power saving. Camera reconfigurations are serialised. Exposures of one second or longer use a single request, regardless of mode or resolution, to avoid an extra long preview frame.
The portal uses service discovery: applications that are not compiled in or are hidden are not displayed. A lightweight profile can omit PiNox on resource-constrained targets. Projection runs in a browser and can also launch locally when an HDMI output is detected.
Conclusion
EIP combines a single camera owner, two coherent data paths, frame-associated caches and asynchronous processing. A shared application programming interface (API) makes those services available to applications.
The measurements show where this architecture delivers a real gain and where it reaches the sensor's limit. The aim is to preserve acquisition, scientific traceability and service responsiveness when several uses coexist on the same Raspberry Pi.
Continue reading
Other version
Inside EIP — Discovery version · Understand the data paths and architectural choices through diagrams.