c++ opencv display Chinese OpenCV installation, configuration and operation

Hits: 0

Today Xiao Cui has a project function and wants to use the [OpenCV] software library to implement it, so he installed OpenCV, and I will share with you the installation process here.

1. What is OpenCV

OpenCV is a cross-platform [computer vision] and machine learning software library released under the BSD license (open source) and can run on Linux, Windows, Android and Mac OS operating systems. It is lightweight and efficient – it consists of a series of C functions and a small number of C++ classes, and provides interfaces to languages ​​such as Python, Ruby, and MATLAB, and implements many general algorithms in image processing and computer vision.

OpenCV is written in C++ language, it has C++, Python, Java and MATLAB interfaces and supports Windows, Linux, Android and Mac OS, OpenCV is mainly geared towards real-time vision applications and utilizes MMX and SSE instructions when available, and today also Provides support for C#, Ch, Ruby, and GO.

2. Application areas

  • Human-Computer Interaction

  • object recognition

  • Image segmentation

  • face recognition

  • Action recognition

  • motion tracking

  • robot

3. The basic structure of OpenCV

OpenCV includes 5 important modules such as CV, CVAUX, CXCORE, HighGUI, ML, etc.

If a library is used to reflect the relationship between these modules, the following structure diagram can be used to show it:

CV—Core Function Library: Contains basic image processing functions and advanced computer vision algorithms, including image processing, image structure analysis, motion description and tracking, pattern recognition and camera calibration.

ML— [Machine Learning] Function Library: Contains some statistical-based classification and clustering tools.

HighGUI—GUI function library: Contains input/output functions for images and videos.

CXCORE—Data structure and linear algebra library: contains some basic data structures and related functions of OpenCV

CVAUX—Auxiliary function library: This module is generally used to store algorithms and functions that are about to be eliminated, and also contains some new experimental functions and algorithms.

4. OpenCV download

Visit OpenCV official website: https://opencv.org/, click Releases

Then find the version you need and click download

If the children’s shoes think that the download speed of the browser is too slow, they can copy the download link and open the Thunderbolt download. I personally test the speed is good.

Five. OpenCV installation

After the download is complete, open the exe file, select the installation folder, click install, and get the opencv folder:

Next, we start to configure environment variables, right-click My Computer, -> Properties -> Advanced System Settings -> Environment Variables, find PATH and add:

D:\Program Files\opencv\build\x64\vc15\bin

Then open “D:\Program Files\opencv\build\x64\vc15\bin” and copy the three files in the figure to “C:\Windows\SysWOW64”:

After the addition is complete, open the terminal and enter opencv_annotation.exe to verify whether the configuration is successful:

This screen appears once indicating that the opencv installation and configuration is successful.

Six. VS2019 configuration

Open vs2019, create a project to create a C++ project:

Then click – “View -“Other Windows -” Property Manager:

Expand the project in the property manager, right-click “Debug | x64”, right-click on the folder and “Add New Project Property Sheet”:

Double-click to open the new property sheet, find the VC++ directory, open the include directory, and add the following two paths:

D:\Program Files\opencv\build\includeD:\Program Files\opencv\build\include\opencv2

Then open “Library Directories” and add the following paths:

D:\Program Files\opencv\build\x64\vc15\lib

Find again: Linker -> Input, open additional dependencies, and add “opencv_world450d.lib”:

After the configuration is complete, open the “Solution Explorer”, right-click the “Source Files” folder and add – Class:

Paste the following code in mian.cpp to test OpenCV: PS (“Find a picture by yourself and fill in the path”)

# include  "mian.h" #includeusing namespace cv;int main(){   //A jpg image file placed on the desktop Mat picture = imread("C:\\Users\\admin\\Desktop\\opencv.jpg" ); imshow("Test program", picture); waitKey(20150901);}

Solution platform changed to x64:

Click Run to see that the picture has been displayed:

If the display is successful, then OpenCV has been installed and configured, and it is still running in the code; if an error occurs, please check the configuration carefully to see if that step is missed.

You may also like...

Leave a Reply

Your email address will not be published.