OpenCV 5.0 Computer Vision Library Released with Rewritten DNN Engine

OpenCV 5.0 debuts a new DNN engine, broader ONNX support, VLM inference, C++17 requirements, and legacy API cleanup.

OpenCV 5.0 has been released as a major update to the widely used open-source computer vision library, bringing a redesigned deep neural network engine, broader ONNX model support, built-in vision-language model support, and a large cleanup of older APIs.

For those unfamiliar, OpenCV is a software library that helps applications “see” and process images or video. It is used in robotics, industrial inspection, cameras, medical imaging, object detection, augmented reality, self-driving research, and AI-driven image analysis.

The biggest change is in the DNN module, which has received its largest update since OpenCV 4.x. OpenCV 5.0 includes a new inference engine that runs alongside the classic one and provides much better support for dynamic shapes, subgraphs, and modern ONNX features. The project says the new engine now covers more than 80% of the ONNX specification, compared with less than 23% in OpenCV 4.x.

The new DNN engine is selected automatically by default, with fallback to the classic engine when needed. Developers can also control the behavior through a new engine parameter or the OPENCV_FORCE_DNN_ENGINE environment variable. OpenCV 5.0 can also be built with ONNX Runtime support, including NVIDIA GPU execution providers when using the relevant build options.

However, the new engine currently runs on CPUs only. GPU support for the new engine is planned for later releases. For now, users who need GPU-based acceleration can still use the classic engine or build OpenCV with ONNX Runtime and NVIDIA execution provider support.

Another major addition is support for multimodal models. OpenCV 5.0 includes the tokenizers and components needed for VLM inference, including attention layers, decoding blocks, post-processing, and KV-cache support. This allows OpenCV to run models that combine image understanding with language output, such as describing an image or answering questions about visual content.

On the performance side, the project says the new DNN engine delivers competitive CPU inference performance, matching or beating ONNX Runtime on some tested models. Image processing also receives improvements, including revised warpAffine, warpPerspective, and remap implementations, with speed gains depending on platform, image size, type, and operation flags.

OpenCV 5.0 also adds new data types in the Core module, including bfloat16, uint32, uint64, int64, and boolean matrix support. It also improves support for 0D and 1D arrays, which matters for DNN shape inference and more general array handling.

Apart from that, OpenCV 5.0 removes the old C API, including legacy C functions and structures from the OpenCV 1.x era. OpenVX support has also been removed, while G-API and the classic ML module have moved to opencv_contrib.

The new release also adds a multi-view camera calibration pipeline, improved reliable estimation through USAC as the default backend, and initial support for mesh and point cloud algorithms, including TSDF and ICP, along with importers and exporters for PLY and OBJ formats.

The baseline requirements have changed as well. OpenCV 5.0 now requires C++17, while Python 2 support has been removed entirely. The project now requires Python 3.6 or newer and exclusively builds and distributes Python 3 bindings.

For additional details, see the release announcement.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Leave a Reply

Your email address will not be published. Required fields are marked *