Zero, introduction,

OpenCV stands for Open Source Computer Vision Library, which is a cross-platform Computer Vision Library. OpenCV is sponsored and co-developed by Intel Corporation. It is distributed under the BSD license and can be used for free in the commercial and research fields. OpenCV can be used to develop real-time image processing, computer vision, and pattern recognition programs. The library can also use Intel’s IPP for accelerated processing.

OpenCV is written in C++ language, its main interface is also C++ language, but still retains a large number of C language interface. The library also has extensive Python, Java and MATLAB/OCTAVE (version 2.5) interfaces. API functions for these languages are available through online documentation. Support for C#, Ch, Ruby, and GO is also available.

Simple understanding of OpenCV is a library, is an SDK, a development package, decompression can be used directly.

Download OpenCV

Go to the OpenCV website to download the version you need.

Click on Library

Since OpenCV supports many platforms, such as Windows, Android, Maemo, FreeBSD, OpenBSD, iOS, Linux and Mac OS, most beginners are using Windows, so download Windows here.

Click Windows to pop up the following interface and wait for 5s automatic download.

After downloading it, it looks like this

Then double click him, decompress, is the big guys say of the installation, the essence is to decompress, decompress out of a folder, nothing else happened. You can put this folder anywhere, but you have to remember where it is.

Is decompressedAfter unzipping, open the folder like this

Build is OpenCV used to use some library files, and sources is OpenCV official for us to provide some demo source code.

2. Configure environment variables

Once you have the OpenCV folder in place, go to Computer – > Properties – > Advanced System Settings – > Environment Variables, find the Path variable, select it and click Edit, and then create. Fill in the Path of your OpenCV executable file and click OK along the way. The environment variables are configured.To find the path to the OpenCV executable file, go to the OpenCV folder you unpacked and choose Build – >x64 – >vc15 – >bin, then like thisThis path is the path of my OpenCV execution file, yours should be similar to mine. Note here that if you are downloading Opencv2. x, after selecting Build, you will need to select x86 or X64, then VC12 (why not VC10 or VC11, usually the latest), the other steps are pretty much the same.

Deploy OpenCV

Having said that, OpenCV is an SDK and you need to develop it using tools such as Visual Studio (of course some big guys only use Notepad or god like Vim). The next step is to deploy OpenCV in Visual Studio.

0. Install Visual Studio

Since the topic is OpenCV, this is not covered here, please Google.

1. Open Visual Studio and create a project

It is best for beginners to build a console project without the interference of other problems.

2. Add the include directory

Start by selecting your project name in the Solution box, as shown in the green box.

Then, choose project – > properties – >VC++ directory – > include directory – > edit

Find your include directory to add, preferably add three, mine looks like this:

D:\opencv\build\include

D:\opencv\build\include\opencv

D:\opencv\build\include\opencv2

3. Add a library directory

Choose project – > properties – >VC++ directory – > libraries directory – > edit

My is D: \ opencv \ build \ x64 \ vc15 \ lib

4. Add additional dependencies

Choose Project – > Properties – > Linker – > Input – > Attach dependencies – > Edit

Add your library file nameLibrary files look like this:There are two files opencv_world341d.lib and opencv_world341.lib

If set to Debug, select Opencv_world341d.lib

If Release, select Opencv_world341.lib

Note that if you are downloading Opencv2. x, there are a lot of library files here, just fill them in.

At this point, all installation and deployment of OpenCV is over, and you can proceed to the next step of use and learning.