openvino的vs和pycharm配置
python3.6.5安装

运行安装程序,一定记得把Add Python 3.6 to PATH这个勾上。

NXOpen Python SDK指南_opencv

安装好后,打开cmd,输入python,若安装成功则如下图。

NXOpen Python SDK指南_NXOpen Python SDK指南_02


然后安装opencv-python:

NXOpen Python SDK指南_环境变量_03


验证opencv-python安装:

NXOpen Python SDK指南_opencv_04

pycharm2017安装

暂时略过

visual stduio 2017专业版安装

"使用C++的桌面开发"一定要勾上,安装位置可自选

NXOpen Python SDK指南_环境变量_05

NXOpen Python SDK指南_opencv_06

openvino2021安装

安装目录默认(修改安装目录后大概率报错)

NXOpen Python SDK指南_计算机视觉_07


然后打开cmd命令提示符,输入

cd /d C:\Program Files (x86)\Intel\openvino_2021.2.185\bin(这是我的openvino安装目录)后回车,再输入setupvars.bat,回车。

若结果如下图,则openvino激活成功。

NXOpen Python SDK指南_python_08


验证openvino安装是否成功:

NXOpen Python SDK指南_opencv_09


若结果出现下图,openvino安装成功。

NXOpen Python SDK指南_NXOpen Python SDK指南_10


pytorch安装(可选):

在cmd里输入如下

pip install torch1.7.1+cu101 torchvision0.8.2+cu101 torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.htmlvisual stduio 2017配置环境

打开系统环境变量,在“PATH”里加入如下:

NXOpen Python SDK指南_python_11

打开vs2017,选择空项目

NXOpen Python SDK指南_环境变量_12


选择空项目,自己选择位置和命名

NXOpen Python SDK指南_环境变量_13


然后在源文件右击>添加>新建项(W),新建cpp文件,选择Release和x64

NXOpen Python SDK指南_计算机视觉_14

然后如下操作

NXOpen Python SDK指南_NXOpen Python SDK指南_15


在出现的Release | x64下选择第一个右击,选择"属性"

NXOpen Python SDK指南_NXOpen Python SDK指南_16


打开如下,选择VC++目录,分别编辑里面的包含目录和库目录

NXOpen Python SDK指南_opencv_17


在包含目录里填入:

C:\Program Files (x86)\Intel\openvino_2021.2.185\opencv\include

C:\Program Files (x86)\Intel\openvino_2021.2.185\deployment_tools\inference_engine\include

C:\Program Files (x86)\Intel\openvino_2021.2.185\opencv\include\opencv2

NXOpen Python SDK指南_计算机视觉_18


在库目录里填入:

C:\Program Files (x86)\Intel\openvino_2021.2.185\opencv\lib

C:\ProgramFiles (x86)\Intel\openvino_2021.2.185\deployment_tools\inference_engine\lib\intel64\Release

NXOpen Python SDK指南_环境变量_19


然后打开"链接器">“输入”,在附加依赖项里填入:

opencv_calib3d451.lib
opencv_core451.lib
opencv_dnn451.lib
opencv_features2d451.lib
opencv_flann451.lib
opencv_gapi451.lib
opencv_highgui451.lib
opencv_imgcodecs451.lib
opencv_imgproc451.lib
opencv_ml451.lib
opencv_objdetect451.lib
opencv_photo451.lib
opencv_stitching451.lib
opencv_video451.lib
opencv_videoio451.lib
inference_engine.lib
inference_engine_c_api.lib
inference_engine_ir_reader.lib
inference_engine_legacy.lib
inference_engine_lp_transformations.lib
inference_engine_onnx_reader.lib
inference_engine_preproc.lib
inference_engine_transformations.lib

NXOpen Python SDK指南_opencv_20


在系统环境变量“PATH”里加入:

NXOpen Python SDK指南_NXOpen Python SDK指南_21


然后重启vs2017。

验证安装是否成功:

#include<opencv2\opencv.hpp>
using namespace cv;
using namespace std;
void main(){
Mat src = imread("C:/Users/13197/Pictures/Saved Pictures/3.png");
imshow("input",src);
waitKey(0);
}

pycharm的openvino配置

在系统环境变量“PATH”里加入目录如下:

NXOpen Python SDK指南_NXOpen Python SDK指南_22


验证代码:

import cv2 as cv
src = cv.imread("C:/Users/13197/Pictures/Saved Pictures/3.png")
cv.imshow("inpur",src)
cv.waitKey(0)

以上。