opencv/modules
Myron Rodrigues 344f8c6400
Merge pull request #27363 from MRo47:openvino-npu-support
Feature: Add OpenVINO NPU support #27363

## Why
- OpenVINO now supports inference on integrated NPU devices in intel's Core Ultra series processors.
- Sometimes as fast as GPU, but should use considerably less power.

## How
- The NPU plugin is now available as "NPU" in openvino `ov::Core::get_available_devices()`.
- Removed the guards and checks for NPU in available targets for Inference Engine backend.

## Test example

### Pre-requisites
- Intel [Core Ultra series processor](https://www.intel.com/content/www/us/en/products/details/processors/core-ultra/edge.html#tab-blade-1-0)
- [Intel NPU driver](https://github.com/intel/linux-npu-driver/releases)
- OpenVINO 2023.3.0+ (Tested on 2025.1.0)

### Example
```cpp
#include <opencv2/dnn.hpp>
#include <iostream>

int main(){
    cv::dnn::Net net = cv::dnn::readNet("../yolov8s-openvino/yolov8s.xml", "../yolov8s-openvino/yolov8s.bin");
    cv::Size net_input_shape = cv::Size(640, 480);
    std::cout << "Setting backend to DNN_BACKEND_INFERENCE_ENGINE and target to DNN_TARGET_NPU" << std::endl;
    net.setPreferableBackend(cv::dnn::DNN_BACKEND_INFERENCE_ENGINE);
    net.setPreferableTarget(cv::dnn::DNN_TARGET_NPU);

    cv::Mat image(net_input_shape, CV_8UC3);
    cv::randu(image, cv::Scalar(0, 0, 0), cv::Scalar(255, 255, 255));
    cv::Mat blob = cv::dnn::blobFromImage(
        image, 1, net_input_shape, cv::Scalar(0, 0, 0), true, false, CV_32F);
    net.setInput(blob);
    std::cout << "Running forward" << std::endl;
    cv::Mat result = net.forward();
    std::cout << "Output shape: " << result.size << std::endl; // Output shape: 1 x 84 x 6300
}
```

model files [here](https://limewire.com/d/bPgiA#BhUeSTBnMc)

docker image used to build opencv: [ghcr.io/mro47/opencv-builder](https://github.com/MRo47/opencv-builder/blob/main/Dockerfile)

Closes #26240

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2025-05-27 14:13:49 +03:00
..
calib3d Merge pull request #27338 from omahs:patch-1 2025-05-21 12:13:50 +03:00
core Merge pull request #27346 from asmorkalov:as/ipp_hal_sum 2025-05-24 16:53:42 +03:00
dnn Merge pull request #27363 from MRo47:openvino-npu-support 2025-05-27 14:13:49 +03:00
features2d Enable Java bindings for SimpleBlobDetector::blobColor 2025-04-20 15:57:41 +09:00
flann flann: remove unused hdf5 header 2024-11-14 19:44:10 +03:00
gapi Merge pull request #26682 from 5usu:4.x 2025-03-31 09:47:34 +03:00
highgui Fixed QT window resize logic. 2025-05-05 14:52:15 +03:00
imgcodecs Merge pull request #27338 from omahs:patch-1 2025-05-21 12:13:50 +03:00
imgproc Merge pull request #27343 from fengyuentau:4x/build/fix_more_warnings 2025-05-21 16:12:09 +03:00
java feat: add conditional inclusion support to header parser 2025-05-19 10:11:52 +03:00
js feat: add conditional inclusion support to header parser 2025-05-19 10:11:52 +03:00
ml Merge pull request #27338 from omahs:patch-1 2025-05-21 12:13:50 +03:00
objc feat: add conditional inclusion support to header parser 2025-05-19 10:11:52 +03:00
objdetect Merge pull request #27228 from utibenkei:fix_java_enum_wrapper 2025-04-21 20:51:38 +03:00
photo Merge pull request #27270 from gursimarsingh:bug_fix_unstable_crf 2025-05-21 08:40:11 +03:00
python feat: add conditional inclusion support to header parser 2025-05-19 10:11:52 +03:00
stitching Merge pull request #26754 from s-trinh:add_bibtex_direct_pdf_links 2025-01-27 10:28:38 +03:00
ts fix: qnx7.0 build 2025-02-27 14:24:18 +08:00
video Merge pull request #25027 from opencv-pushbot:gitee/alalek/tests_filter_debug 2025-03-21 10:22:17 +03:00
videoio Merge pull request #27338 from omahs:patch-1 2025-05-21 12:13:50 +03:00
world cmake: use /INCREMENTAL:NO with MSVS 2015 2023-12-07 19:46:27 +00:00