依赖环境
- windows 10/11
- visual studio 19
- opencv460
- openvino23.3
相关项下载
openvino23.3
OpenCV
可根据自己的需要,下载对应的版本。
属性配置
openvino

- 将bin与3rdparty里面的bin目录下的dll文件的上级目录包含在系统环境变量中 或者 拷贝到 系统路径下(C:\Windows\System32)
- 在vs新建项目后,【视图】->【其它窗口】->【属性管理器】->【Release|X64】->【添加新的属性表】,如图:

点击添加后,在Relase|X64内会显示新添加的属性列表(此列表配置后,此后其它项目需要直接添加即可,无需重新配置openvino)。 - 打开openvino233X64R.props并配置openvino,如下所示

4.opencv属性配置与上述流程一样,此处仅展示配置图

测试
#include <iostream>
#include <string>
#include <openvino/openvino.hpp> //openvino header file
#include <opencv2/opencv.hpp> //opencv header file
int main(int argc, char *argv[])
{
// -------- Get OpenVINO runtime version --------
std::cout << ov::get_openvino_version().description << ':' << ov::get_openvino_version().buildNumber << std::endl;
// -------- Step 1. Initialize OpenVINO Runtime Core --------
ov::Core core;
// -------- Step 2. Get list of available devices --------
std::vector<std::string> availableDevices = core.get_available_devices();
// -------- Step 3. Query and print supported metrics and config keys --------
std::cout << "Available devices: " << std::endl;
for (auto &&device : availableDevices)
{
std::cout << device << std::endl;
}
// -------- Step 4. Read a picture file and show by OpenCV --------
cv::Mat img = cv::imread("zidane.jpg"); // Load a picture into memory
cv::namedWindow("Test OpenVINO & OpenCV IDE", 0);
cv::imshow("Test OpenVINO & OpenCV IDE", img);
std::cout << "Image width: " << img.cols << " height: " << img.rows << std::endl;
cv::waitKey(0);
cv::destroyAllWindows();
return 0;
}
本文详细介绍了如何在Windows10/11环境下,使用VisualStudio2019进行OpenCV4.6.0和OpenVINO23.3的安装、属性配置,以及如何编写和测试C++程序来展示OpenVINO功能。

3138

被折叠的 条评论
为什么被折叠?



