当前位置:网站首页>Visual studio 2022 downloading and configuring opencv4.5.5
Visual studio 2022 downloading and configuring opencv4.5.5
2022-07-03 11:52:00 【qq_ thirty-seven million seven hundred and five thousand five h】
opencv introduction
1 brief introduction
OpenCV(Open Source Computer Vision Library) Is an open source computer vision library , It provides a lot of functions , These functions implement computer vision algorithms very efficiently ( The most basic filtering to advanced object detection are covered ).
OpenCV Use C/C++ Development , It also provides Python、Java、MATLAB And other language interfaces .
OpenCV It's cross platform , Can be in Windows、Linux、Mac OS、Android、iOS Wait for the operating system to run .
OpenCV It's widely used , Including image mosaic 、 Image denoising 、 Product quality inspection 、 human-computer interaction 、 Face recognition 、 Action recognition 、 Motion tracking 、 Driverless, etc .
OpenCV Machine learning modules are also provided , You can use normal Bayes 、K Nearest neighbor 、 Support vector machine 、 Decision tree 、 Random forests 、 Artificial neural network and other machine learning algorithms .
OpenCV Is an open source computer vision library , It can be downloaded from http://opencv.org obtain .
1999 year ,Gary Bradski( Gary · Bradski ) At that time, I worked at Intel , With the vision of providing a stable infrastructure for practitioners of computer vision and artificial intelligence to promote the development of the industry , He started OpenCV project .
OpenCV Library use C Language and C++ Language writing , Can be in Windows、Linux、Mac OS X Wait for the system to run . At the same time, we are actively developing Python、Java、Matlab And some other language interfaces , Import the library into Android and iOS Develop applications for mobile devices in .
OpenCV Since its inception, the project has received strong support from Intel and Google , Thank you in particular Itseez, The company did most of the early development . thereafter ,Arraiy The team joins the project and is responsible for maintaining the always open source and free OpenCV.org.
Itseez It's a vision company in Russia , Specializing in computer vision algorithms .2016 year 5 month , Intel acquired the company , With “ Help Intel users create innovative deep learning CV application , If autonomous driving 、 Digital security monitoring and industrial testing ”( General manager of Intel Internet of things Doug Dacies So to speak ).
OpenCV Designed for efficient computation , Emphasis on real-time application development . It consists of C++ Language and deep optimization , So you can enjoy the advantages of multithreading .
OpenCV One of our goals is to provide an easy-to-use computer vision interface , To help people quickly build sophisticated visual applications .
OpenCV The library contains information derived from various fields of computer vision 500 Multiple functions , Including quality inspection of industrial products 、 Medical image processing 、 Security 、 interactions 、 Camera calibration 、 Binocular vision and Robotics .
Because computer vision and machine learning are often used together , therefore OpenCV It also contains a complete 、 A universal machine learning library (ML modular ). This sub library focuses on statistical pattern recognition and clustering .ML The module of OpenCV Core tasks of ( Computer vision ) Quite useful , But this library is generic enough , It can be used for any machine learning problem .
use BCD The license
2 install vs2022
Win10 Of 64 Bit operating system , Directly in VS Download from the official website VisualStudioCommunity, Default installation , Installation is VisualStudioCommunity2022:
( Installed 【 The workload 】 The step is 【 Use C++ Desktop development 】 and 【 Universal Windows Platform development 】 And other toolsets 【VisulStudio Extended development 】)
3 OpenCV4.5.5 download
Download address https://opencv.org/releases/
4 decompression OpenCV environment variable
cmd -> sysdm.cpl
5 Visual Studio2022 To configure OpenCV
5.1 open visual studio 2022 Create a new project , choice C++ Console Application
5.2 Add project property sheet .
For ease of use , We can also add attribute tables , To configure OpenCV Properties of , The attribute table is props file . After each new project , Just put the property sheet under the project path , And add it to the project to use , There is no need to configure repeatedly OpenCV Properties of . Avoid repeated configuration OpenCV Properties and switching compilation mode get trouble , Choose... For yourself .
Find your own Debug and Release Pattern , For example, I want to use x64 Of Debug, I'll choose the second , Right click to select “ Add new project property sheet ”.
Open the existing VS project , In the lower left corner - Property Manager -DeBug|X64 In the right - Add new project property sheet . Then set the name as :Debug_x64_opencv.props And save .
The property sheet file is saved in the project folder , The next time you want to use it , Direct copy 、 Paste it into the new project folder , And add it to the project attribute manager , Very convenient .
End of configuration OpenCV After the attributes , You can start using it OpenCV 了 . It is best to save the attribute table in a fixed path , Easy to copy 、 Paste , Use in the next project . Adding a property sheet is also simple , First copy the attribute table 、 Paste into the project folder of the current project , Then open the “ Property Manager ”, Find the corresponding “ Pattern ” and “ digit ”, Here is “Debug|x64”, Then right click and select “ Add an existing property sheet ”, Copy 、 Just add the pasted property sheet file .
5.3 Configure property sheet
Right click the attribute table just added , Click properties . Click on VC++ The include directory in the directory , Add to our include directory
F:\soft\bin\opencv\opencv\build\include\opencv2
F:\soft\bin\opencv\opencv\build\include( Without this VS It will report an error but it can run )
VC++ The Library Directory in the directory , Add to our library Directory
stay “ General properties - The linker - Input - Additional dependency ” Add %opencv%\build\x64\vc15\lib\opencv_world451d.lib,%opencv% For your own opencv Catalog . Different versions of this file have different names , Just put your own version of opencv Fill in the file name in the folder . Be careful if ****d.lib, Because only d.lib It corresponds to dubug edition
perhaps All options -> Additional dependency
6 test
When running, you must choose DeBug|x64、
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main() {
Mat image = Mat::zeros(300, 600, CV_8UC3);
circle(image, Point(300, 200), 100, Scalar(0, 255, 120), -100);
circle(image, Point(400, 200), 100, Scalar(255, 255, 255), -100);
imshow("show window", image);
waitKey(0);
return 0;
}
7 Quickly configure in new projects
In a new project , Just in the attribute manager , Right click DeBug|x64- Add an existing property sheet - Select the property sheet we just configured Debug_x64_opencv.props You can quickly complete the configuration
attach : To configure Release Pattern
What we just configured can only be DeBug|x64 Run in , Let's configure Release|x64 The property sheet of , Can be in Release|x64 Run in .
In the property manager , Right click Release|x64- Add new project property sheet . Then set the name as :Release_x64_opencv.props And save .
Right click the newly created property sheet - attribute , stay “ General properties -VC++ Catalog - routine - Contains the directory ” and “ General properties -VC++ Catalog - routine - The library catalog ” The settings in are the same as above .
stay “ General properties - The linker - Input - Additional dependency ” Add %opencv%\build\x64\vc15\lib\opencv_world451.lib,%opencv% For your own opencv Catalog . Different versions of this file have different names , Just put your own version of opencv Fill in the file name in the folder . Be careful if ****.lib, Because only .lib It corresponds to Release edition
4. Click OK to save the property sheet , And test . When running, you must choose Release|x64
In a new project , Just in the attribute manager , Right click Release|x64- Add an existing property sheet - Select the property sheet we just configured Release_x64_opencv.props You can quickly complete the configuration
thus DeBug and Release Next OpenCV It's all configured , And the configuration can also be completed quickly in new projects
8 There may be problems
problem 1: Lost in computer msvcp120.dll
This is a problem , Download again msvcp120.dll, Then add to the corresponding bin In the folder , That is, the environment variable added above , these two items. dll Has been uploaded to Baidu cloud , Please download by yourself .
Baidu network disk link :https://pan.baidu.com/s/1CLnom87fShhl7wF4yAKggw
Extraction code :28a7
problem 2: Lost in computer opencv_highgui2413d.dll
This is a problem , Generally, environment variables are not added to ( routing problem ) Or do not restart the computer after adding the environment variables to make the environment variables take effect .
problem 3: Application failed to start properly , As shown in the figure below :
No will bin The file path is added to the environment variable , You also need to reboot .
problem 4: The following error occurred , Interface not supported , The main situation is : The camera can't be turned on or wait “ Interface not supported ” It can only be opened after it is finished
This problem , When you turn on the camera , Keep returning false, Sometimes you are reminded to choose a video format FFMPEG, May be OpenCV Has been destroyed , You can use another version of OpenCV To test it , What I'm using now opencv342, It may be broken , I'll use it well opencv2410 To test , Found that the camera can be turned on , Re next opencv Just fine , It can also be used DirectX To fix dll.
VideoCapture cap(0);
while (cap.isOpened())
problem 5:“CAP_PROP_FRAME_COUNT”: undeclared identifier perhaps “CAP_PROP_FRAME_COUNT”: No “cv” Members of
This happens , It may be due to OpenCV Version causes ,OpenCV3 It can be written like this , however OpenCV2 It needs to be written CV_CAP_PROP_FRAME_COUNT
problem 6: Pop up the error prompt box “ Can't find mfc100”
Go to 360 Download a collection of Microsoft's common runtime libraries , commonly 360 It will pop up automatically .
边栏推荐
- vulnhub之GeminiInc v2
- Qt OpenGL 旋转、平移、缩放
- Cacti monitors redis implementation process
- R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
- . \vmware-vdiskmanager. exe -k “c:\\xxxxx.vmdk”
- 同事写了一个责任链模式,bug无数...
- Vulnhub's cereal
- ORACLE进阶(一) 通过EXPDP IMPDP命令实现导dmp
- POI excel cell wrap
- 错排问题 (抽奖,发邮件)
猜你喜欢
Kibana - installation and configuration of kibana
PHP基础
Unity3D学习笔记5——创建子Mesh
vulnhub之Ripper
《剑指offer 04》二维数组查找
rxjs Observable filter Operator 的实现原理介绍
The excel table is transferred to word, and the table does not exceed the edge paper range
ftp登录时,报错“530 Login incorrect.Login failed”
vulnhub之Nagini
Machine learning 3.2 decision tree model learning notes (to be supplemented)
随机推荐
Repo ~ common commands
P3250 [hnoi2016] Network + [necpc2022] f.tree path tree section + segment tree maintenance heap
Dynamic programming (interval DP)
ORACLE进阶(一) 通过EXPDP IMPDP命令实现导dmp
The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
Qt OpenGL 纹理贴图
优化接口性能
How to get started embedded future development direction of embedded
Numpy np. Max and np Maximum implements the relu function
The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities
STL教程9-容器元素深拷贝和浅拷贝问题
vulnhub之GeminiInc
R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
Groovy测试类 和 Junit测试
Dynamically monitor disk i/o with ZABBIX
Go language to realize static server
STL tutorial 8-map
量化计算调研
Qt+VTK+OCCT读取IGES/STEP模型
vulnhub之Ripper