1、 Software requirements
Vs2019 Community Edition, win10 operating system, opencv4.1.0, opencv_ contrib_ 4.1.0、cmake3.15.3
Vs2019 community version (free) download address
Opencv4.1.0 download address
OpenCV_ contrib_ 4.1.0 download address
Cmake download address
2、 Cmake compilation
In D: opencv_ Create a newbuild folder under 4.1.0 directory
Enter cmake and configure OpenCV_ 4.1.0
Configure opencv_ contrib_ 4.1.0
Note: don’t hit the following path in the second step
3、 Vs2019 compilation
Enter D: OpenCV_ 4.1.0 OpenCV.sln double-click
4、 System environment variable configuration
Right click computer – Properties > Advanced System Settings > environment variables > system variables > path
Click new to fill in D: OpenCV_ 4.1.0\newbuild\install\x64\vc16\bin
5、 Vs2019 environment variable configuration
- Open vs2019, create a new empty project, and open the property manager (View Property Manager / view other property manager)
- Double click Microsoft.Cpp .x64.user
Configuration includes directory (general properties – VC + + Directory – include directory), Library Directory (general properties – VC + + Directory – Library Directory)
Add in include directory
D:\opencv_4.1.0\newbuild\install\include
D:\opencv_4.1.0\newbuild\install\include\opencv2
Add to Library Directory
D:\opencv_4.1.0\newbuild\install\x64\vc16\lib
Configure additional dependencies (linker input additional dependencies)
How to get linker
opencv_world410d.lib
opencv_aruco410d.lib
opencv_bgsegm410d.lib
opencv_bioinspired410d.lib
opencv_calib3d410d.lib
opencv_ccalib410d.lib
opencv_core410d.lib
opencv_datasets410d.lib
opencv_dnn410d.lib
opencv_dnn_objdetect410d.lib
opencv_dpm410d.lib
opencv_face410d.lib
opencv_features2d410d.lib
opencv_flann410d.lib
opencv_fuzzy410d.lib
opencv_gapi410d.lib
opencv_hfs410d.lib
opencv_highgui410d.lib
opencv_imgcodecs410d.lib
opencv_imgproc410d.lib
opencv_img_hash410d.lib
opencv_line_descriptor410d.lib
opencv_ml410d.lib
opencv_objdetect410d.lib
opencv_optflow410d.lib
opencv_phase_unwrapping410d.lib
opencv_photo410d.lib
opencv_plot410d.lib
opencv_quality410d.lib
opencv_reg410d.lib
opencv_rgbd410d.lib
opencv_saliency410d.lib
opencv_shape410d.lib
opencv_stereo410d.lib
opencv_structured_light410d.lib
opencv_superres410d.lib
opencv_surface_matching410d.lib
opencv_text410d.lib
opencv_tracking410d.lib
opencv_video410d.lib
opencv_videoio410d.lib
opencv_videostab410d.lib
opencv_ximgproc410d.lib
opencv_xobjdetect410d.lib
opencv_xphoto410d.lib
6、 Program verification
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv) {
Mat box = imread("1.jpg");
Mat box_in_sence = imread("2.jpg");
//Create akaze
auto akaze_detector = AKAZE::create();
vector<KeyPoint> kpts_01, kpts_02;
Mat descriptors1, descriptors2;
akaze_detector->detectAndCompute(box, Mat(), kpts_01, descriptors1);
akaze_detector->detectAndCompute(box_in_sence, Mat(), kpts_02, descriptors2);
//Define descriptor matching violence matching
Ptr<DescriptorMatcher> matcher = DescriptorMatcher::create(DescriptorMatcher::BRUTEFORCE);
std::vector< DMatch > matches;
matcher->match(descriptors1, descriptors2, matches);
//Draw match
Mat img_matches;
drawMatches(box, kpts_01, box_in_sence, kpts_02, matches, img_matches);
imshow("AKAZE-Matches", img_matches);
imwrite("D:/result.png", img_matches);
waitKey(0);
return 0;
}
7、 Vs2019 property page does not have Microsoft.Cpp . x64. User solution
You can check another blog I wrote. Is vs2019 property manager available Microsoft.Cpp Solution for. X64. User
Reference blog
Here is the article about explaining vs2019 + opencv-4-1-0 + opencv-contrib-4-1-0 in detail. For more related vs2019 opencv opencv contrib content, please search previous articles of developer or continue to browse the following related articles. I hope you can support developer more in the future!