Table of Contents
- What changed from 5.0 to 5.1
- Release highlights
- Updated Core module
- Updated Imgproc module
- Updated DNN module
- Updated Features module
- Updated Calibration and Geometry modules
- Updated Video I/O and Image codecs
- Updated Python bindings
- Platform support
- New in OpenCV 5.1
- Revised samples
- Updated documentation
This page describes new features and other notable changes in OpenCV 5.1, the first feature update of the 5.x series, released in November 2026.
The complete list of changes, with a link to every pull request, is in the change log.
What changed from 5.0 to 5.1
OpenCV 5.1 completes the transition of the DNN module to the new engine: the classic engine has been removed, and the new engine runs on NVIDIA GPUs as well as on CPU. The core module adds a broadcasting element-wise engine and a complete set of N-D array operations, text rendering supports complex scripts, and new 3D functionality ranges from an OpenGL visualizer to monocular visual odometry.
Most code written for 5.0 builds and runs on 5.1 unchanged. The exceptions are listed under Cleanup and in the "Migration notes" part of the change log.
Release highlights
General changes
- One DNN engine, on CPU and GPU. ONNX and TFLite models are loaded by the new engine, which now has a CUDA backend. See Updated DNN module.
- Consistent saturation.
cvRound,cvFloor,cvCeilandsaturate_castnow saturate out-of-range values on every platform. Previously the result depended on the CPU: x86 returnedINT_MIN, while 64-bit ARM and RISC-V wrapped around. 32-bit integer add and subtract saturate as well. - IPP moved into HAL. Intel IPP calls in imgproc and in core math functions now go
through the HAL interface, the same way other vendor libraries plug into OpenCV.
cv::ipp::useIPP()switches all of them on and off at runtime. - More functions accept
CV_Bool: distanceTransform, connectedComponents, morphological operations, matchTemplate masks, SIFT masks, inpaint masks, boundingRect, findTransformECC masks and imwrite. - Behavior changes:
Net::forward()keeps the output type of the model. Models that declare FP16 or BF16 outputs now return FP16 or BF16Mats; the high-levelModelclasses still return float.cv::bitwise_notandoperator~now invertCV_Boolarrays element by element, sotruebecomesfalseandfalsebecomestrue. Previously they flipped every bit of each byte, which turned all elements intotrue.- In Python, an
int64NumPy array becomesCV_32Sonly when all its values fit intoint32; otherwise it becomesCV_64S. Previously it was always truncated toCV_32S. - In Python, a
Matwith a zero-length dimension comes back as an empty array of that shape instead ofNone. WITH_UNIFONTis nowOFFby default, so the CJK font is no longer built in. See Updated Imgproc module.
- Third-party updates: IPP 2026.1.0, KleidiCV 26.09, libtiff 4.7.2, and FFmpeg 9.0.2 in the Windows build.
Cleanup
- The classic DNN engine has been removed.
cv::dnn::EngineTypenow has three values:ENGINE_AUTO(0, default),ENGINE_OPENCV(1) andENGINE_ORT(2). Code that passesENGINE_CLASSICorENGINE_NEWhas to switch to one of these. The numbers changed too, so if you setOPENCV_FORCE_DNN_ENGINEin your environment, check it:1now selects the OpenCV engine and2selects ONNX Runtime. - The TensorFlow importer has been removed.
readNetFromTensorflow()is gone; convert TensorFlow models to ONNX, for example with tf2onnx. ONNX and TFLite remain supported. Thednn_superresmodule in opencv_contrib now loads ONNX models only. Leftover Caffe protobuf code was removed as well. - Core API. The
Mat_ << a, b, ccomma initializer has been removed, andtransposeNDis deprecated in favor of the N-Dcv::transpose. - Calibration flags.
CALIB_DISABLE_SCHUR_COMPLEMENThas a new value, because the old one collided withCALIB_TILTED_MODEL. Numeric fisheye flag values saved by 4.x are now rejected with an error. - Headers. Public geometry headers no longer include
logger.hpp.
Updated Core module
-
Broadcasting element-wise engine. Arithmetic, comparison and math functions broadcast operands NumPy-style, for mismatched shapes as well as channel counts. The new
cv::texprevaluates an element-wise expression written as a string, for examplecv.texpr("clamp({0} - {1}, 0, 10)", [a, b]), in one fused pass, so intermediate results stay in cache instead of being stored as temporary matrices. The DNN element-wise layers run on the same engine. -
FP8 data types. Two FP8 depths were added,
CV_8F_E4M3FNandCV_8F_E4M3FNUZ, with SIMD conversions and support in common core functions such as split/merge, LUT, norm, minMaxLoc, countNonZero andFileStorage. -
N-D array API.
cv::concat,cv::split,cv::slice,cv::repeat,cv::reshapeandcv::transpose(with an arbitrary axis order) work on N-dimensional arrays, andcv::squeeze,cv::unsqueezeandcv::flattenwere added.cv::reduceworks on N-D arrays throughReduceParamsand gainedREDUCE_PROD,REDUCE_L1,REDUCE_L2,REDUCE_LOG_SUMandREDUCE_LOG_SUM_EXP. -
CUDA-backed
UMat.cv::cuda::getCudaAllocator()givesUMata CUDA memory allocator with explicit host-device transfers. -
Performance.
- DFT and DCT were rewritten with universal intrinsics and parallelized, and
matchTemplatewas parallelized too. norm,batchDistanceand Hamming distance are vectorized, which speeds up ORB and BRISK matching.findNonZeroon 8-bit input is up to 15x faster on sparse masks.sum,minMaxLocandcountNonZerohave AVX-512 paths, andsortruns in parallel.
- DFT and DCT were rewritten with universal intrinsics and parallelized, and
Updated Imgproc module
-
Text rendering based on HarfBuzz. Text is now shaped with HarfBuzz, so scripts that need complex shaping, such as Arabic and Devanagari, render correctly and font ligatures work. To keep the library small, only the Rubik font is built in by default. The italic and CJK fonts are optional (
WITH_ITALICFONT,WITH_UNIFONT), andcv::FontFace::setBuiltinFontcan load them from a font file at runtime. -
cv::alphaCompositeblends images with the Porter-Duff compositing operators. -
Oklab color space.
cvtColorconverts between RGB/BGR and Oklab. -
IPP through HAL. resize, cvtColor, boxFilter, filter2D, Sobel, Scharr, Canny, distanceTransform, matchTemplate, threshold, bilateralFilter and getRectSubPix reach IPP through the HAL interface instead of calling it directly.
-
Faster on platforms without IPP, such as Windows on ARM: the Laplacian column filter, pyrUp, pyrDown, adaptiveThreshold, calcHist, boxFilter and blur have new vectorized code paths.
Updated DNN module
-
CUDA backend. In 5.0 the new engine was CPU-only; in 5.1 it also runs on NVIDIA GPUs. The CUDA backend executes the graph layer by layer on
UMatdevice buffers, covers transformer layers and can replay the whole network as a CUDA Graph. cuDNN's graph API with runtime-compiled kernels is available through theWITH_CUDNNJITCMake option. ResNet-50 runs in 0.80 ms on an RTX PRO 6000 Blackwell (FP32 with TF32), against 0.88 ms for the ONNX Runtime 1.31 CUDA execution provider. -
ONNX coverage. New layers include Scan, LpPool, CumProd, CausalConvWithState, BitCast, inverse real DFT, ImageDecoder and Compress. Many existing ones, including Resize, GridSample, GRU, LSTM, Attention, PRelu and Softmax, were fixed or extended to follow the specification.
-
Better LLM and VLM support.
Net::reserveKVCache()pre-allocates the attention KV cache, which makes token generation up to 4.95x faster.- Attention gained past/present KV cache inputs, LinearAttention and FlexAttention were added, and GroupQueryAttention supports rotary embeddings, which Granite-Docling and PaddleOCR-VL need.
cv::dnn::Tokenizersupports the WordPiece and Unigram methods, which adds BERT and ALBERT tokenization.- Quantized models: com.microsoft
MatMulNBits, DynamicQuantizeLinear, ConvInteger and MatMulInteger. Cast and CastLike support FP8, FP4, INT4/UINT4 and E8M0, and FP8 models can be loaded. - External weights are memory-mapped instead of copied, which reduces memory use when loading large ONNX models.
-
Faster CPU inference. A few representative numbers:
- Graph fusion was rewritten into one backend-agnostic pass: MPHand is 2.27x faster, EfficientNet 1.96x.
- More operations stay in the blocked memory layout: RAFT 1.40x, DenseNet121 1.44x faster.
- Convolution work is split between threads according to its size: MPPose 1.64x, MPPalm 1.45x, YuNet 1.33x faster.
- LSTM was reworked: CRNN went from 17.5 ms to 2.8 ms.
- ConvTranspose now uses MLAS GEMM: the SAM2 decoder went from 68.5 ms to 36.8 ms on one thread.
- int8 inference: DenseNet121 int8 is 7.4x faster, with AVX-VNNI depthwise convolution and multi-threaded MatMul.
-
Other changes.
- The TFLite importer runs more models on the new engine, including YOLO.
blobFromImage,blobFromImagesandImage2BlobParamstake aninterpolationparameter; passINTER_LINEAR_EXACTfor bit-exact preprocessing.
Performance
The numbers below are inference time in milliseconds (lower is better). ONNX Runtime (1.31.0) is the official Python package with the CPU execution provider. Both runtimes use all logical CPUs of the machine. A representative selection is shown here; see the complete benchmark tables for every model, the test setup and output checks.
Intel i9
| Model | OpenCV | ONNX Runtime (1.31.0) |
|---|---|---|
| MobileNetv2 | 1.24 | 1.16 |
| ResNet_50_v1 | 7.13 | 14.69 |
| YOLOv8 | 10.00 | 24.43 |
| VIT_Base_Patch16_224 | 32.61 | 43.18 |
| SAM2 ENCODER | 1693 | 2308 |
Intel i7
| Model | OpenCV | ONNX Runtime (1.31.0) |
|---|---|---|
| MobileNetv2 | 3.66 | 2.21 |
| ResNet_50_v1 | 18.60 | 17.43 |
| YOLOv8 | 25.42 | 24.76 |
| VIT_Base_Patch16_224 | 74.25 | 73.94 |
| SAM2 ENCODER | 5158 | 6070 |
Apple M5
| Model | OpenCV | ONNX Runtime (1.31.0) |
|---|---|---|
| MobileNetv2 | 4.74 | 4.54 |
| ResNet_50_v1 | 20.76 | 35.16 |
| YOLOv8 | 24.36 | 43.03 |
| VIT_Base_Patch16_224 | 83.44 | 86.29 |
| SAM2 ENCODER | 5780 | 4243 |
AMD Ryzen 9 9950X
| Model | OpenCV | ONNX Runtime (1.31.0) |
|---|---|---|
| MobileNetv2 | 2.15 | 1.73 |
| ResNet_50_v1 | 7.94 | 6.41 |
| YOLOv8 | 12.06 | 15.09 |
| VIT_Base_Patch16_224 | 23.15 | 25.86 |
| SAM2 ENCODER | 1523 | 2200 |
View complete benchmark tables →
Updated Features module
cv::XFeat, a DNN-based feature detector and descriptor.- SIFT on OpenCL. SIFT detection and description on
UMatinput run on OpenCL, up to 1.87x faster than the CPU path at 1080p. - LightGlue with DISK.
LightGlueMatcherworks with DISK features (LG_DISK) as well as ALIKED, andsetKeypointNormalization()withLG_NORM_MAX_SIDEmatches the keypoint normalization of the reference LightGlue implementation.
Updated Calibration and Geometry modules
calibrateHandEyeandcalibrateRobotWorldHandEyeare available from Python.calibrateCamera,stereoCalibrate,initCameraMatrix2DandregisterCamerasacceptfloat64points.- The Schur complement calibration solver is now deterministic and 1.45x faster with 32 threads.
- Fisheye extrinsic refinement uses Levenberg-Marquardt and handles ill-conditioned views better.
Updated Video I/O and Image codecs
- Camera enumeration.
cv::videoio_registry::enumerateDevices()lists the cameras that the V4L2, MSMF, DirectShow, AVFoundation and Aravis backends can open, and the newopencv_camera_enumeratetool prints the list from the command line. - Encoder controls in VideoWriter. With the FFmpeg and GStreamer backends you can set bitrate, CRF, preset, GOP size and pixel format.
- FFmpeg 9.0 is supported, and the Windows FFmpeg build was updated to 9.0.2, which also fixes slow AV1 decoding.
- AVIF and TIFF. 16-bit AVIF images can be read and written (libavif 1.4.0 or newer), and
the AVIF alpha plane has its own quality setting (
IMWRITE_AVIF_ALPHA_QUALITY).IMWRITE_TIFF_COMPRESSION_LEVELsets the compression level for DEFLATE, LZMA, ZSTD and WebP compression in TIFF.
Updated Python bindings
- Exact NumPy dtypes for bfloat16 and float8. By default,
CV_16BFand FP8 outputs reach Python as float32 arrays. Afterimport ml_dtypesandcv.setUseExactNumpyDtypes(True), they keep their exact bfloat16 and float8 dtypes. - Typing stubs are more accurate for optional outputs, scalar operands and NumPy input to
UMat.
Platform support
- Windows on ARM.
parallel_for_no longer skips work with the default PPL backend, so building with OpenMP is no longer needed as a workaround.- An ArmPL HAL backend accelerates
gemm,SVDandinvert. - The vendored MLAS library is used by DNN with MSVC, and OpenCV can be built with clang-cl together with the KleidiCV HAL.
- RISC-V. RVV code paths were added across core, imgproc, video and DNN: convolution (including Winograd), GEMM, int8 convolution, normalization layers, optical flow and more.
New in OpenCV 5.1
- Linear assignment solver.
cv::linearAssignment()solves rectangular assignment problems with the Jonker-Volgenant algorithm, for example matching tracks to detections in a multi-object tracker. - 3D visualizer.
cv::viz3dis a new OpenGL-based viewer for meshes, point clouds, RGB-D frames and camera trajectories. - 3D Gaussian Splatting.
cv::loadGaussianSplatsloads splat scenes, and viz3d renders them. - Monocular visual odometry.
cv::slam::VisualOdometryis the first step toward SLAM in OpenCV. - Point cloud processing: statistical and radius outlier removal, normal orientation, Ball-Pivoting meshing and 3D bounding boxes.
- ColorHashTSDF, a TSDF volume type that combines hashed storage with color.
Revised samples
- The object detection samples use a Darknet-converted ONNX model for YOLOv3, which gives better results.
- A new Qwen3-TTS text-to-speech sample, in C++ and Python, shows the new
MatMulNBitssupport. - The Python HoughLines/HoughLinesP and odometry samples were updated for 5.x, and the OpenGL samples were fixed to build again.
Updated documentation
- New tutorials cover using pre-built binaries and convex hull, new pages describe the HAL and the DNN engine, and the universal intrinsics tutorial was extended.
- The core documentation explains the bit layout of
Mat::type()and the 1DMatvector constructor, and has a module introduction for 5.1.
The full list of changes is in the change log. For migration from OpenCV 4.x, see the Migration Guide.
- Home
- Deep Learning in OpenCV
- Running OpenCV on Various Platforms
- OpenCV 5
- OpenCV 4
- OpenCV 3
- Development process
- OpenCV GSoC
- Archive
© Copyright 2019-2025, OpenCV team