
OpenCV 5 released: rewritten DNN engine and a jump in ONNX coverage
The OpenCV team shipped version 5.0 with a rebuilt deep-learning engine, ONNX operator coverage up from roughly 13% to more than 64%, and CPU inference that beats ONNX Runtime on several models.
OpenCV 5 is out. The OpenCV team published the release on June 4, 2026 and calls it one of the most important releases in the library's history. OpenCV has more than 86,000 GitHub stars and over a million installs a day, and it underpins robotics, industrial inspection, medical imaging, AR/VR and a large share of production computer-vision systems. The pip package is scheduled for June 8, with the release timed around CVPR 2026 in Denver.
A rewritten DNN engine
The headline change is a new deep-learning engine. According to the team, ONNX operator coverage rose from roughly 13% in the 4.x line to more than 64% in OpenCV 5. The old engine imported a small fraction of the ONNX operator set and struggled with dynamic shapes; the new one is built around a typed operation graph with shape inference, constant folding and operator fusion. It now loads models with If and Loop subgraphs, symbolic and dynamic shapes, and quantize/dequantize graphs. Attention and MatMul fusions collapse the MatMul to Softmax to MatMul pattern at the heart of transformers into one fused attention operation, backed by a FlashAttention-style implementation.
Three engines behind one API
Upgrades rarely break existing pipelines: the readNet family accepts an engine argument. ENGINE_AUTO is the default and tries the new engine first, falling back to the classic 4.x path if a model fails to load. ENGINE_NEW forces the graph engine, which is CPU-only for now; ENGINE_CLASSIC keeps the old engine and remains the route to CUDA and OpenVINO targets; ENGINE_ORT uses a bundled ONNX Runtime build. The team benchmarked the native engine against ONNX Runtime on CPU (Intel Core i9-14900KS, Ubuntu 24.04): XFeat 6.56 ms against 8.61, DINOv2 small 23.78 against 29.58, YOLOv8n 10.9 against 12.15, OWLv2 1,090 against 1,489, BiRefNet 7,178 against 9,503 — a 4% to 36% edge depending on the model.
LLMs, inpainting and a leaner core
OpenCV 5 can run large language and vision-language models inside the DNN module, with a built-in tokenizer and a KV-cache for autoregressive decoding; Qwen 2.5, Gemma 3, PaliGemma and the GPT-2 family are supported, and a Qwen 2.5 test matched ONNX Runtime token for token. Object removal with the LaMa inpainting model runs in a single forward pass. The new Features module replaces Features2D with the learned detectors ALIKED and DISK and the LightGlue matcher, while SIFT and ORB remain. The core adds FP16 and BF16 types, 0D and 1D Mat support, broadcasting, NumPy 2.x compatibility and keyword arguments; the legacy C API is deprecated and C++17 is the minimum standard. A redesigned hardware acceleration layer lets Intel IPP, Arm KleidiCV, Qualcomm FastCV and RISC-V Vector kernels plug in transparently, with reported 3-4x speedups on common ARM operations.
SiTech — AI-powered web development
We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.