Why Embedded Vision Pipelines Stall When OpenCV Reaches ARM and FPGA
Quick Overview
Problem: An OpenCV pipeline that meets frame-rate targets on a workstation loses much of its throughput on the target SoC, and profiling the algorithm does not explain where it went.
Common failure points: OpenCV built without the acceleration backends the target supports, buffer handovers that copy frames nobody counted, cache behaviour that turns a zero-copy path into a slow one, DNN module changes across OpenCV 5.0 and 5.1, FPGA libraries that mirror the OpenCV API but not its programming model.
Where it appears: Industrial inspection and machine vision, automotive camera and access-control modules, mobile robotics, medical imaging devices, broadcast capture hardware.
Engineering focus: Build-configuration audit, per-handover copy accounting, buffer ownership across V4L2 / ISP / NPU, model format and runtime pinning, HLS dataflow design for FPGA offload.
The detection pipeline met its frame-rate target on the development workstation, on 4K frames, with CPU headroom left over. The algorithm was settled, the models were trained, and the remaining task was described in the plan as "port to target."
On the target module the same pipeline ran several times slower.
The first response was to profile the operators, and the profile was unhelpful. No single OpenCV call dominated. The undistortion was reasonable, the resize was reasonable, and the inference call matched the vendor benchmark almost exactly. Every stage looked acceptable and the total was far outside budget.
The second response was to ask for a faster SoC — a request six weeks and a BOM revision away from an answer, and aimed at the wrong thing. The silicon was not saturated. The pipeline was spending its time moving frames between buffers owned by different subsystems, on a build of OpenCV configured without the acceleration the target could provide.
Neither of those is an algorithm problem, and neither appears in an operator profile.
What Actually Decides Embedded Frame Rate
OpenCV is portable, so a pipeline that works on the desktop is assumed to be a pipeline that works on the target once it cross-compiles. The source does port. What does not port is the execution context around it:
- Which accelerated kernels were compiled into this particular build.
- Where each frame physically lives at each stage, and how often it is copied between owners.
- Whether the memory a stage reads from is cached for the processor that reads it.
- Whether the DNN features the prototype depends on still exist in the version that ships on the device.
Those four decide embedded frame rate. None are visible in application code, and all four differ between a workstation and a target board. The three sections below answer them in the order teams usually hit them.
Why OpenCV Slows Down on Arm
Short answer: usually because the build on the device is not the build the team thinks it is, and because frames are crossing more buffer boundaries than anyone has counted.
OpenCV ships two layers of CPU acceleration, and they behave differently.
The first is OpenCV's own universal intrinsics — a portable SIMD layer that covers SSE/SSE2/SSE4.2 on x86, NEON on ARM, VSX on PowerPC, MSA on MIPS, LSX on LoongArch, RVV on RISC-V and WASM. Where no SIMD extension is available at compile time, OpenCV falls back to a C++ implementation of the same intrinsics, which works correctly but runs slower. So a standard AArch64 build is normally already using NEON for a wide range of operations.
The second layer is the external HAL backends. OpenCV 5 routes these through a redesigned Hardware Acceleration Layer built on Universal Intrinsics 2.0, with vendor libraries underneath: Intel IPP on x86, Arm KleidiCV on AArch64 using NEON, SVE and SME, Qualcomm FastCV on Snapdragon through the Hexagon DSP and NPU, and RISC-V Vector kernels. On Arm operations such as resizing and warping the project reports speedups of roughly 3–4x from KleidiCV over the baseline.
The practical point is that neither layer is guaranteed to be configured the way you expect, and the answer is one line of output rather than a guess:
std::cout << cv::getBuildInformation(); // C++
print(cv2.getBuildInformation()) # Python
Read the HAL field, the baseline and dispatched SIMD fields, and the module list. A build with "HAL: YES (carotene, KleidiCV)" is a different machine from one with the HAL absent, and a library pulled from a distribution feed, a pip wheel or an inherited Yocto recipe may be either. Teams that have never printed this are reasoning about code paths without knowing which ones are compiled in.
The second cause is buffer movement. cv::Mat normally owns its memory, and the constructor that takes an external data pointer deliberately does not copy — it wraps the caller's buffer, and the Mat does not take ownership of it. That makes zero-copy wrapping of a V4L2 or DMA-BUF mapping entirely possible, and it is the right pattern. The problem is that it is not the default pattern: a pipeline assembled from VideoCapture, a few cvtColor calls, a resize and a blobFromImage will allocate and copy at several points, and at 4K each of those passes costs real DDR bandwidth regardless of how fast the operator is.
A published multi-camera benchmark on an RK3576 platform gives a sense of the scale. The vendor compared three implementations of the same four-camera 720p stitching pipeline and reported roughly five full-chain memory copies and about 300 ms end to end for the serial OpenCV CPU version, about three copies and roughly 150 ms with OpenCL GPU offload, and no copies and roughly 100 ms for a DMA-BUF design with cv::Mat constructed over the mapped buffer. The individual GPU kernels in the middle configuration were genuinely faster — undistortion fell from about 10 ms to about 1 ms — but the explicit cv::Mat to cv::UMat transfers cost around 15 ms on upload and 10 ms on download, consuming most of the gain.
When DMA-BUF Makes Performance Worse
Short answer: when the next consumer of the buffer is the CPU rather than another DMA engine, and the mapping that stage reads through is uncached.
The obvious correction to copy overhead is to share one buffer across the pipeline. That is usually right, and it is where the RK3576 numbers above end up. But the result is not automatic, and teams regularly report that enabling DMA-BUF made a pipeline slower.
The reason is cache behaviour. Whether a DMA-BUF import is mapped cached or uncached for CPU access depends on the exporting driver, the platform and how the buffer is mapped — it is not a property of DMA-BUF itself. These platform-specific aspects of buffer management are part of Linux kernel and BSP engineering. On a number of arm64 platforms the practical outcome is an uncached mapping, and there are long-running kernel discussions and vendor forum threads about exactly that. When the consumer is another DMA engine — a GPU, a 2D blitter, a video encoder, a display controller — this is irrelevant and the sharing is clean. When the consumer is a CPU-side OpenCV operator walking the pixels, every access goes to DRAM without cache line reuse, and that stage can measure slower than the version with a copy into cached memory.
So buffer strategy is a per-stage decision, not a project-wide one: shared buffers for DMA-to-DMA hops, and one deliberate copy into cached memory ahead of a CPU-heavy stage if measurement says so. The same reasoning applies at integration boundaries — some accelerator runtimes have no public API for importing a camera buffer descriptor directly, so a staging copy into a runtime-owned buffer is unavoidable and belongs in the latency budget from the start rather than being discovered during integration.
What Changed in the OpenCV DNN Module
Teams treating OpenCV as a stable dependency are working from an outdated picture. Two releases in 2026 changed the DNN module substantially, and the changes are easiest to reason about kept separate.
OpenCV 5.0 — June 2026
- New graph-based DNN engine. ONNX operator coverage rose from roughly 22% to over 80%, with shape inference, constant folding and operator fusion.
- Darknet and Caffe importers removed — readNetFromDarknet() and readNetFromCaffe() no longer exist.
- The new engine was CPU-only at this release. Pipelines using CUDA or OpenVINO backends had to pin the classic engine explicitly with ENGINE_CLASSIC.
- Legacy C API removed, C++17 required, Python 3.6+ only. G-API and the classic ML module moved to opencv_contrib; CascadeClassifier (Haar) and HOGDescriptor moved to xobjdetect; features2d renamed to features with several descriptors relocated to xfeatures2d.
OpenCV 5.1 — November 2026
- The classic engine was removed. EngineType is now ENGINE_AUTO, ENGINE_OPENCV or ENGINE_ORT; code passing ENGINE_CLASSIC or ENGINE_NEW to readNet*() has to be changed.
- The TensorFlow importer was removed — readNetFromTensorflow() is gone. ONNX and TFLite remain supported.
- A CUDA backend was added to the new engine, with per-op executors, UMat device buffers, transformer layers and CUDA Graph replay, plus cuDNN JIT support. The published change log does not record an equivalent OpenVINO path for the new engine, which is worth verifying against your own build if that backend is on your critical path.
Read together: a project pinned to 4.x that upgrades straight to 5.1 loses three model importers across the two releases and the engine selection its code may be written against. A project already on 5.0 loses the classic engine and the TensorFlow importer. Either way the migration is better scheduled than met during a routine dependency bump. Anything still depending on G-API, Haar cascades or the relocated descriptors also needs opencv_contrib in the build, which many minimal embedded recipes omit.
These changes should also be considered when designing edge inference pipelines and quantised models for deployment on target hardware.
When to Move a Stage to FPGA
Short answer: when the operation is high rate, bounded in scope, latency-critical and stable enough to justify a synthesis loop measured in hours — and when you have budgeted for the fact that the familiar API is not a familiar programming model.
Good candidates are sensor interfacing, debayer, lens correction, format conversion, line-rate filtering and multi-sensor synchronisation. Poor candidates are anything still under algorithmic iteration. Promwad's FPGA design services cover the implementation of high-rate, latency-critical processing stages in hardware.
AMD's Vitis Vision Library is deliberately shaped to look like OpenCV: its functions are documented as mostly matching their OpenCV equivalents, and its container is named xf::cv::Mat. The resemblance is real but partial, and two differences decide project estimates.
First, data placement. Vitis Vision's own documentation states that data is explicitly copied from cv::Mat to xf::cv::Mat and stored in physically contiguous memory for performance, then copied back after processing. The host-to-fabric boundary is a copy by design, and it belongs in the budget alongside the kernel time. This boundary is an important architectural consideration in SoC and MPSoC FPGA design.
Second, sizing. The ROWS and COLS template parameters are documented as the maximum height and width the hardware kernel is built for, not the exact image size. xf::cv::Mat carries runtime rows and cols members for the actual image size, and constructors that set them, so resolution can vary at runtime within the compiled maximum — the dense pyramidal optical flow example in the library does exactly this, setting height and width per pyramid level. What does force a rebuild is exceeding the compiled maximum, or changing pixel type, channel count or the pixels-per-cycle parallelism, since those shape the datapath itself.
That distinction matters for scoping, and a runtime-configurable design is achievable: in one Promwad FPGA project the controllers were made configurable at runtime specifically so the FPGA project would not need rebuilding for each device configuration, with one build serving many devices and bitstream updates delivered remotely.
How to Diagnose It
One table answers most of this, and most teams have never built it. One row per stage boundary, not per stage.
| Stage | Buffer owner | Copy? | Cached for reader? | Measured (ms) |
| Sensor → ISP | Kernel / V4L2 | No | n/a (DMA) | |
| ISP → capture buffer | V4L2 (MMAP or DMABUF) | No | Check mapping | |
| Capture → colour convert | 2D engine or CPU | Depends | Check mapping | |
| Colour convert → OpenCV ops | cv::Mat | Often yes | Usually yes | |
| OpenCV ops → tensor pack | cv::Mat → blob | Yes | Yes | |
| Tensor → NPU/GPU runtime | Runtime-owned | Often forced | n/a (DMA) | |
| Runtime → post-processing | cv::Mat | Depends | Check mapping |
Fill the last column on target hardware under production load, not on a bench clip. Three things fall out of it immediately: which handovers copy, which stages read uncached memory, and whether the accelerator is actually the constraint. Alongside the table, four checks are worth running before any hardware decision is costed:
- Print cv::getBuildInformation() on the shipped device image and confirm the HAL, SIMD and module lines.
- Confirm the OpenCV version on the device matches the version in the build manifest.
- Check CPU and accelerator utilisation together in steady state — high CPU with an idle NPU points at the data path, not the model.
- Confirm the model format is one the deployed OpenCV version still imports.
If a hardware escalation is being costed and this table does not exist, the escalation is being argued without evidence.
Failure Patterns
Scenario 1. An inspection pipeline meets its target in the lab and falls well short on the line, with no anomalous operator in the profile. The OpenCV binary came from the board vendor's SDK image and was built without the AArch64 HAL backend, so resize and warp run on the baseline path rather than the accelerated one. Rebuilding the library recovers much of the gap without touching application code.
Scenario 2. A team enables DMA-BUF to remove copies between camera and NPU, and throughput drops. The NPU path improves as expected, but a CPU-side blob analysis stage is now reading through an uncached mapping and costs more than all the copies that were removed. The fix is hybrid: shared buffers for the DMA-to-DMA hops, one deliberate cached copy ahead of the CPU stage.
Scenario 3. A field-proven detector stops loading after a routine dependency bump. The model was a Darknet YOLO configuration read directly by the DNN module for years; the Darknet importer went in 5.0 and the classic engine in 5.1. The model now needs converting to ONNX and revalidating — work discovered during a release build rather than during planning.
Embedded Vision Engineering
Embedded vision pipelines rarely miss their targets because the algorithm is wrong. They miss because acceleration was never configured into the build, because frames cross more buffer boundaries than anyone counted, or because the library changed underneath the project. Closing that gap takes build-configuration audit, per-handover measurement and buffer architecture — not a larger SoC. Promwad develops embedded vision systems on ARM SoCs, FPGA fabric and dedicated accelerators, from sensor interface and ISP through to NPU deployment and production validation. The pattern shows up most in multi-camera inspection, automotive camera and access-control modules, and mobile robotics. Vision pipeline optimisation is also an important part of robotics engineering, particularly for systems operating under tight latency and power constraints.
Engineering Experience Across Vision and Acceleration Platforms
From Our Projects
Facial Recognition on an i.MX 8M Plus Camera for a European Car-Sharing Fleet
A European car-sharing company needed in-vehicle access control by face, running entirely on the camera. Promwad built the smart camera platform around the NXP i.MX 8M Plus Quad — four Cortex-A53 cores up to 1.8 GHz, an integrated NPU rated at 2.3 TOPS, and a single MIPI CSI camera input — with a Yocto Linux build, OpenCV in the vision path, and TensorFlow Lite 2.6.0 with Python 3.9 for inference.
This is the exact architecture this article describes: OpenCV handling capture, conversion and classical pre-processing, a separate runtime handling the neural stage, both sharing one constrained Arm SoC with a fixed thermal and power budget, and a single camera feeding both. The scope covered hardware design, the Yocto Zeus OS, the recognition prototype, tamper detection, OTA firmware updates, a GCP-hosted fleet management service and a mobile app. Facial data is stored as a mathematical representation rather than raw images.
Reported outcome: the proof of concept was completed and an MVP built and tested, with recognition accuracy above 99% at up to 16 frames per second on the target hardware — a frame rate that is a system property of that SoC and that pipeline, not a model benchmark. Such pipeline-level validation is essential when developing automotive cameras and vision systems.
FPGA Capture for 4K Multi-Camera Broadcast
On the FPGA side, a European streaming operator commissioned high-speed OpenGear SDI-to-IP cards for multi-camera capture of live sports and music events. The cards use a Xilinx FPGA with IP cores converting SDI to IP under SMPTE 2110, specified to process eight SDI 4K120 streams, with a 10 Gb/s NAS built around a Lattice CertusPro-NX acting as a SAS expander across multiple SSDs. The cards are OpenGear-compliant and hot-swappable, managed from a web dashboard.
It is the clean example of the boundary this article draws: at eight simultaneous 4K120 streams there is no CPU pipeline to optimise, and the work belongs in fabric from the first architecture review rather than being migrated there after a frame-rate problem appears. Similar high-bandwidth capture requirements can be addressed through custom frame grabber solutions.
Solution Approach
Step 1: Establish what is actually running before changing anything.
Print cv::getBuildInformation() on the target and read the HAL line, the SIMD baseline and dispatch lines, the OpenCL line and the module list. Confirm whether an external HAL backend is present, whether contrib modules are included, and which OpenCV version the device image actually carries. This takes under an hour and routinely invalidates the premise of an optimisation effort.
Step 2: Build the handover table before optimising operators.
Instrument stage boundaries, not just stages, and fill in the table in section 9 on target hardware under production load. The same discipline applies to any AI inference pipeline measured end to end rather than at the model boundary.
Step 3: Pin the vision stack to the deployment, not the development machine.
Fix the OpenCV version, build flags and contrib modules in the Yocto or Buildroot recipe, and store models in a format the deployed version still imports — in practice ONNX or TFLite from OpenCV 5.1 onward. Treat a library version bump as a change requiring revalidation, in the same way a kernel bump is treated.
At this stage the work is pipeline measurement and buffer architecture, not a faster part. Where the vision stack sits on a heterogeneous SoC, the allocation of work across CPU, NPU and DSP is the layer above this one, and the firmware orchestration between those engines determines how much of the theoretical throughput is reachable at all.
The same principles of workload allocation and data movement apply when designing DSP pipelines on embedded platforms.
Real Trade-Offs
Rebuilding OpenCV with vendor HAL backends recovers CPU performance at no application-code cost, but it moves the library off the distribution's update path and makes the team responsible for CVE tracking and rebuilds for the product lifetime.
DMA-BUF removes copies between DMA-capable subsystems, but cache behaviour decides whether CPU-side stages gain or lose. Mixed strategies perform best and are harder to reason about, which raises the cost of every later change.
Moving a stage to FPGA fabric gives deterministic latency and frees the CPU, but the host-to-fabric boundary is a copy by design and the synthesis loop is measured in hours. It pays for stable, bounded operations at high pixel rates, not for logic under algorithmic iteration.
OpenCV's new DNN engine removes a separate inference dependency and covers most current ONNX models, but it is narrower in backend coverage than a mature vendor runtime. Where the target NPU has a good SDK, splitting the pipeline — OpenCV for pre- and post-processing, vendor runtime for inference — usually wins on throughput and support, an approach that generalises to composable embedded AI pipelines built from classical CV and neural stages.
Promwad's edge AI and NPU deployment services cover the integration and validation of such pipelines on target hardware.
Staying on OpenCV 4.x defers the migration and keeps the Darknet, Caffe and TensorFlow importers working. It also forgoes the new HAL, the RISC-V kernels and the ONNX coverage, and the gap widens with each release. For products with a multi-year field life, the migration is better scheduled than deferred.
Typical Embedded Vision Engineering Tasks
Vision Pipeline Audit and Benchmarking
Build-configuration review, per-stage and per-handover timing, copy accounting, and a measured baseline before any hardware decision is taken.
Buffer Architecture and Zero-Copy Design
V4L2 and DMA-BUF integration, ISP and 2D-engine offload, cache strategy per stage, and camera-to-accelerator data paths on ARM SoCs.
FPGA Vision Acceleration
HLS dataflow design, custom frame grabber and sensor interface logic, and offload of bounded high-rate pixel operations onto Zynq, Kria and Lattice fabric.
Model Deployment and Runtime Integration
ONNX and TFLite conversion, quantisation, NPU runtime integration, and validation of accuracy and latency on target hardware.
FAQ
Is OpenCV still a reasonable choice for embedded vision in 2026?
Why is my OpenCV pipeline slower on the target than on the desktop?
What changed in OpenCV 5 that affects embedded projects?
Does zero-copy always improve embedded vision performance?
When should vision processing move from the CPU to FPGA fabric?
How do we choose an embedded vision platform without being misled by TOPS numbers?
Related Engineering Cases
- Edge AI Visual Defect Detection on Videology SCAiLX: Joint Promwad–Videology demo of on-device defect detection. Promwad trained a YOLOv8 detector for three defect classes — missing components, damaged parts and colour mismatches — on frames rendered in Blender, since the production line it models does not exist. Runs with INT8 quantisation and NPU-adapted layers on Videology's SCAiLX module, a 42 × 42 mm SoM with an integrated NPU and roughly a 2 W typical power budget.
- On-Device Conversational Edge AI for Multi-Camera Vision: Promwad's own multi-camera reference design, combining video analytics with a local LLM agent that takes natural-language commands to switch camera views, retrieve people seen in the last thirty minutes, bind gestures and adjust the Neo ISP. Built on NXP i.MX 95 and an FRDM i.MX 8M Plus board with an Ara240 M.2 accelerator, entirely on-device with no cloud dependency. Shown at NXP Tech Days Istanbul 2025, Stuttgart 2026 and VISION 2026.
- AI Camera Platform for Exterior Vehicle Access: Promwad internal R&D project building a reusable camera platform on a single Ambarella CVflow SoC that runs image processing and inference together. Covers gesture-based access using MediaPipe ported to the hardware, driver face recognition with profile loading over the vehicle bus, and low-power parking surveillance. Reported under its tested configuration: gesture decision within 120 ms, face verification above 99% for two enrolled users, deep-sleep current below 100 µA.
- Firmware Development for an FPGA-Based Microscope: Firmware migration onto a MYIR FZ3 Zynq UltraScale+ SoM to replace a discontinued platform, prototyped on a ZCU102. The FPGA handles instrument timing rather than pixel processing: up to 12 digital channels enabling lasers and controlling camera exposure, up to 4 analogue channels driving scanner position in a plane, synchronisation across all of them, and status and diagnostic signals exposed to Linux. The controllers are runtime-configurable, so one build serves many device configurations and bitstreams can be updated remotely.
- AI-Based Automatic Number Plate Recognition for Smart Parking: Promwad trained three neural models and handed them to the client as reusable number-plate scanners: YOLOv8 for vehicle detection (mAP 0.885, trained on a COCO subset covering vehicles, buses, trucks and motorbikes), YOLOv8 for plate detection (mAP 0.991, trained on about 2,000 generated images), and PP-OCRv3 for text recognition (character error rate 0.067 on the validation sample). Weight pruning cut inference time by roughly 4x and 8x for the first two models respectively.