System designGuide

Embedded vision JPEG snapshots with on-device object detection

Plan embedded vision JPEG snapshots alongside object detection, with driver checks, memory budgets, encoding choices and SPI versus I2C transfer limits.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01Choose the processing boundary first
  2. 02Prove the documented sensor and driver combination
  3. 03Separate snapshot resolution from detection resolution
  4. 04Budget peak memory, not just the model file
  5. 05Choose the JPEG path deliberately
  6. 06Calculate SPI and I2C transfer time
  7. 07Schedule capture, inference and transfer together
  8. 08Compare catalog architectures without assuming missing features
  9. 09Check the complete pipeline before ordering
  10. 10Questions

A high-resolution snapshot and a small object-detection input can come from the same camera, but they compete for capture bandwidth, memory and processing time. This guide is for embedded-system designers who need both functions while sending images to another device. Start by choosing where capture, JPEG encoding and inference will run, then prove that the documented interfaces support that arrangement. The broader board-level camera selection guide covers physical integration; here, the decision is whether the complete pipeline fits your resource and timing budgets.

Choose the processing boundary first

There are three practical architectures. Select one before choosing a sensor or processor, because each puts a different burden on the embedded host.

Architecture Where JPEG and detection run Main advantage Main constraint
Sensor module connected directly to an embedded processor JPEG may run in the sensor, an accelerator or software; detection runs on the processor Close control of acquisition and application scheduling Exact sensor, driver and capture-peripheral support must be documented
Board-level camera connected to a host Encoding and detection run on the host unless camera documentation states otherwise Camera transport can be separated from application processing Host memory, transport bandwidth and acquisition-software compatibility
Smart camera with supported inspection tools Supported processing runs inside the camera Potentially reduces external processing requirements Custom models, image export and interface options depend on the device

An I2C connection used to configure sensor registers is not evidence that images can be transferred over I2C. Likewise, a camera with an internal processor does not automatically accept your detection model.

If a second device must receive images over SPI, identify the bridge explicitly. It may be application firmware on the processing host rather than a camera interface. The camera acquisition software compatibility guide helps distinguish camera transport, acquisition libraries and application integration.

Prove the documented sensor and driver combination

Treat compatibility as a chain rather than a matching connector. A supported sensor on one processor board does not establish support on another board using a similar processor.

Before committing hardware, obtain manufacturer or distributor documentation covering:

  • Sensor supply rails, signal levels, clock requirements and connector pinout.
  • Image interface type, lane arrangement or parallel-bus width, and supported clock rates.
  • Driver support for the exact processor, operating system or firmware release.
  • Supported resolution, pixel format, frame-rate and exposure combinations.
  • JPEG output support, if required, including how compressed frame boundaries are detected.
  • Commercial software, model-runtime and redistribution licensing requirements.

A sensor register manual describes sensor capabilities, not necessarily what a board's driver exposes. Register writes outside the documented driver interface can also conflict with settings reapplied during acquisition.

For a compressed stream, confirm how the receiver determines frame length. Do not assume a capture peripheral designed for fixed-size raw frames accepts variable-length JPEG data. The camera pipeline format negotiation guide explains why matching a sensor output format to the receiving pipeline matters.

Separate snapshot resolution from detection resolution

Choose snapshot resolution from the detail you need to preserve. Choose detection input size from model accuracy and available processing capacity. These are separate decisions, even when both images originate from one exposure.

For a hypothetical inspection, suppose the scene is 200 mm wide and a relevant feature is 0.4 mm wide. An initial target of 4 pixels across that feature gives:

Required image width = scene width × pixels per feature / feature width Required image width = 200 mm × 4 / 0.4 mm = 2,000 pixels At a 4:3 aspect ratio: required height = 2,000 × 3 / 4 = 1,500 pixels Required pixel count = 2,000 × 1,500 = 3,000,000 pixels

This is a sampling estimate, not a guarantee of detection accuracy. Lens contrast, focus, motion and lighting can remove detail before the software receives it. The high-resolution camera guide explains the distinction between pixel count and useful image detail.

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Now consider resizing a 2,048-pixel-wide source image to a 320-pixel-wide detector input. The scale factor is 320 / 2,048 = 0.15625. A feature spanning 8 source pixels becomes only 1.25 detector pixels wide. A detailed saved snapshot therefore does not prove that the detector receives enough information.

Use representative labeled images to compare full-frame resizing, cropping and tiled inference. Preserve the crop position and scale transformation so detections can be mapped back onto the original snapshot. Letterboxing also requires tracking the added padding.

Budget peak memory, not just the model file

A compressed image can be small while its capture and encoding buffers are large. Budget memory by buffer lifetime, including anything retained while a transfer is pending.

For a hypothetical 2,048 × 1,536 image represented as RGB with 3 bytes per pixel:

Raw frame bytes = width × height × bytes per pixel Raw frame bytes = 2,048 × 1,536 × 3 = 9,437,184 bytes Raw frame memory = 9,437,184 / 1,048,576 = 9 MiB Two full-resolution buffers = 2 × 9 MiB = 18 MiB Detector input = 320 × 320 × 3 = 307,200 bytes ≈ 0.293 MiB

The following example assumes independently established working-memory requirements. It is not a specification for any catalog product.

Allocation Illustrative memory budget
Two full-resolution RGB buffers 18 MiB
Detector input buffer 0.293 MiB
Bounded JPEG destination buffer 1 MiB
Inference, encoder and driver working allocations combined 10 MiB
Subtotal About 29.3 MiB
Subtotal plus 25% contingency About 36.6 MiB

The JPEG allocation is a design limit to validate, not a predicted compressed size. Define what happens if an encoded frame exceeds it.

Measure model weights, activations, scratch space, color conversion, stacks and transport buffers. Avoid counting shared allocations twice, but do not assume two libraries share memory unless their interfaces permit it.

Two source buffers also provide little queueing freedom. If both remain owned by encoding or inference, acquisition has nowhere to place another frame. Any additional retained source frame adds another full-frame allocation. Check contiguous-memory, DMA-accessibility and cache-coherency requirements separately from total free memory.

Choose the JPEG path deliberately

Sensor-side JPEG can reduce incoming data volume when the sensor and receiving interface both support it. However, a detector usually needs decoded pixels or a supported tensor representation, not a JPEG file.

Encoding path Benefit Cost or limitation to verify
Sensor-side JPEG Can reduce capture-bus traffic and host encoding work Detection may require decoding; simultaneous raw output may be unavailable
Hardware JPEG on the host Can reduce CPU encoding time Accelerator formats, buffer alignment and memory movement still matter
Software JPEG on the host Flexible application integration when supported CPU time, working memory and copying compete with inference

Prefer capturing once and deriving both outputs when the platform supports it. A raw frame can feed resizing for detection and JPEG encoding for storage or transfer. Keep its buffer valid until both consumers finish.

If the sensor produces only JPEG in the selected mode, budget decoding before inference. If you switch between a low-resolution detection mode and a high-resolution snapshot mode, measure reconfiguration time and the first valid frame after switching. Exposure behavior and image timing can change during that transition.

JPEG quality settings do not define a fixed compression ratio. Detailed scenes and sensor noise can increase file size substantially. Validate image quality and maximum observed size across realistic scenes, including difficult low-light captures.

Calculate SPI and I2C transfer time

Calculate transfer time using encoded bytes and measured payload throughput. A clock setting alone does not describe the application data rate.

For an illustrative JPEG of 200 KiB:

Payload bytes = 200 × 1,024 = 204,800 bytes Ideal SPI transfer time = payload bytes × 8 / SPI bit rate Ideal SPI transfer time = 204,800 × 8 / 20,000,000 ≈ 0.082 seconds

At 80% payload efficiency, the same SPI transfer takes approximately 0.082 / 0.80 = 0.102 seconds. That assumed efficiency must be replaced with a measurement using your transaction size and software stack.

I2C has an additional acknowledgment clock for each transferred byte. At a hypothetical 400 kbit/s bus clock, the byte-and-acknowledgment lower bound is:

I2C transfer time ≥ payload bytes × 9 / bus clock rate I2C transfer time ≥ 204,800 × 9 / 400,000 = 4.608 seconds

Addressing, transaction boundaries, clock stretching and software gaps increase that time. Both devices must explicitly support the selected bus speed and image-transfer protocol.

Example connection Calculated time for the example JPEG What the estimate excludes
SPI at 20 Mbit/s About 82 ms Framing, pauses and software overhead
SPI at the same clock, assuming 80% payload efficiency About 102 ms Additional delays beyond the assumed efficiency
I2C at 400 kbit/s At least 4.61 s Addressing, transaction gaps and clock stretching

I2C can suit settings, status and sparse small transfers. It is generally a poor fit for frequent large snapshots at these example rates. For electrical and addressing constraints on shared control buses, use the multiple-camera shared-bus guide.

Define message framing, image length, sequence number, integrity checking and timeout behavior. Split large images into bounded chunks so the receiver can reject incomplete transfers without losing message alignment.

Schedule capture, inference and transfer together

A pipeline can fit in memory and still fail because its average producer rate exceeds its consumer rate. Queue depth only delays that failure.

For example, 5 snapshots per second at 200 KiB each generate:

Snapshot traffic = 5 × 204,800 = 1,024,000 bytes per second SPI payload capacity at the example efficiency = 20,000,000 × 0.80 / 8 SPI payload capacity = 2,000,000 bytes per second

The average traffic fits this illustrative link budget. But a 1 MiB image would occupy approximately 1,048,576 / 2,000,000 = 0.524 seconds of transfer time. A short burst of large images can therefore create a backlog despite an acceptable average.

Use separate bounded queues for detection work and snapshot delivery. For live detection, replacing an old pending frame with a newer one may be appropriate. For traceable inspection snapshots, dropping images may be unacceptable; apply trigger backpressure or stop accepting work before buffers are exhausted.

Record timestamps for exposure or acquisition, inference start, inference completion and transfer completion. Measure both processing latency and frame age. A detector can finish quickly while processing an image that waited too long in a queue.

Do not treat trigger-command completion as image availability. The single-capture timeout guide covers that distinction.

When the normal design fails, change the requirement explicitly: reduce snapshot frequency, crop the saved image, select a faster documented transport, or move processing to a larger host. Do not hide overload behind an expanding queue.

Compare catalog architectures without assuming missing features

The catalog provides camera interfaces and imaging attributes. It does not establish the complete JPEG, inference or SPI integration required by this application.

For a host-based design, board-level cameras provide alternatives to directly integrating a sensor. The camera finder helps narrow transport and imaging requirements.

The LS-BCM-0020 lists a GigE interface, rolling shutter and CS-mount. It is a candidate for evaluating a host-based acquisition path, not evidence of sensor-side JPEG support.

Board-level cameras6.3 MP board-level camera, IMX178, 1/1.8" rolling shutter, 18 fps (LS-BCM-0020)LS-BCM-0020
Sensor format
1/1.8"
Lens mount
CS-mount
Resolution
6-10 MP
Shutter
Rolling
$290.00View partBuild a system with it

The LS-BCM-0056 lists 12 MP resolution, a GigE interface and C-mount. A larger source image increases the importance of validating capture bandwidth, buffering and resize cost.

Board-level camerasGigE board camera / module, 12 MP, Color/Mono, 1.6 μm×1.6 μm pixels (LS-BCM-0056)LS-BCM-0056
Sensor format
1/2"
Lens mount
C-mount
Interface
GigE
Resolution
12 MP
$209.00View partBuild a system with it

For a different processing boundary, compare smart cameras and vision sensors. The LS-SMC-0063 is a GigE smart camera. Its catalog entry does not establish custom object-detection model deployment, JPEG export or an SPI/I2C image interface; those capabilities need separate confirmation.

Smart cameras & vision sensors1.6 MP smart camera, 60 fps, 16 mm lens, white light (polarized, transparent light) (LS-SMC-0063)LS-SMC-0063
Interface
GigE
Resolution
Up to 3 MP
$1,110.00View part

If a compact embedded host cannot meet the measured budget, vision controllers are another architecture to investigate. Verify the required runtime, camera support, processing capacity and transfer interface rather than selecting by processor class alone.

Check the complete pipeline before ordering

Use an acceptance checklist that exercises the intended functions together, not isolated demonstrations:

  1. Documented compatibility: Match the exact sensor or camera, firmware, driver, receiving hardware and runtime versions.
  2. Image-path proof: Capture the required snapshot format and derive the detection input without an undocumented mode combination.
  3. Memory ownership: Identify who owns every buffer and exactly when it becomes reusable.
  4. Peak memory: Measure simultaneous capture, encoding, inference and transfer allocations with difficult scenes.
  5. Detection accuracy: Validate resized or cropped inputs against representative labeled examples, including small targets.
  6. Transfer limits: Measure payload throughput, maximum image size and behavior when the receiver stalls.
  7. Overload behavior: Confirm bounded queues, explicit image rejection or backpressure, and useful error reporting.
  8. Recovery: Test repeated start/stop cycles, interrupted transfers and reconnection without stale images entering the next job.
  9. Production permissions: Confirm applicable software, runtime and redistribution terms through the documented licensing route.

A sensible acceptance run includes sustained operation and deliberate receiver pauses. Check peak memory and queue depth throughout; average throughput alone can conceal a slow accumulation of retained frames.

Bring the required snapshot dimensions, detection rate, maximum delivery latency and host interface to the camera configurator. If support for the combined operating modes remains uncertain, use application support before committing to hardware.

Questions

Can any supported image sensor provide JPEG snapshots?

Not automatically. Sensor compatibility depends on electrical connections, the image interface, capture hardware and the exact driver or firmware. A documented sensor feature may still be unavailable through a particular platform. Confirm JPEG output, resolution changes and exposure controls for the complete supported combination before choosing hardware.

Should object detection use the full-resolution snapshot?

Use a shared source frame when the documented pipeline supports it, but generate separate representations for each task. Preserve the full-resolution image for the snapshot and resize or crop a copy for detection. Keep frame identifiers and coordinate transforms so detections remain associated with the correct original image.

Is sensor-side JPEG always better than software encoding?

It may reduce incoming image bandwidth and avoid host encoding work, but detection can then require JPEG decoding. A raw acquisition path with host encoding may be simpler when both consumers need the same pixels. Compare total memory, processing time and supported output combinations rather than encoder location alone.

Can SPI or I2C carry high-resolution JPEG snapshots?

SPI can be suitable when both endpoints support the required protocol and measured payload throughput meets the delivery deadline. I2C is usually better reserved for configuration and status when snapshots are large or frequent. Calculate transfer time from encoded byte counts, including protocol overhead and receiver pauses.

Do the listed cameras provide JPEG encoding and custom object detection?

The catalog information provided here does not establish the complete feature combination. Board-level camera entries identify imaging and transport attributes; the smart-camera entry does not confirm custom model deployment or JPEG export. Obtain documentation for the required acquisition modes, runtime and host-transfer path before treating any candidate as a complete solution.