Opencv2.4.13+vs2015+cmake development environment configuration, solve nonfree problem

Source: Internet
Author: User

I use opencv3.1.0, very useful, and VS20115 configuration and compression is much simpler. But for nonfree this library does not support, so I put a opencv2.4.13 source code package, with CMake compile, tool download: Click to open the link, the first is to extract OpenCV files, and then compile with cmake, these detailed process I will not write, online information a lot , the compiler chooses vs2015 Win64 or vs2015, which is not related to the system. However, it should correspond to the VS2015 configuration. In general, select Debug Win32 or Debug x64 under VS2015. This corresponds to the compiler selected above. Next refer to click Open Link Configuration VS2015, the process is identical. The nonfree is ready to use. This is my test program:

#include <opencv2\core\core.hpp> #include <opencv2\features2d\features2d.hpp> #include <opencv2\
highgui\highgui.hpp> #include <opencv2\nonfree\nonfree.hpp> #include <iostream> using namespace CV;
using namespace Std; int main () {System ("color 2F");//change console font color//load meta picture and show Mat srcIamge1 = Imread ("C:\\users\\wjch\\desktop\\house.png
	", 1);
	Mat srcIamge2 = Imread ("c:\\users\\wjch\\desktop\\tower.jpg", 1); if (!srciamge1.data| |!
		Srciamge2.data) {printf ("Read picture error, check path");
	return false;
	} imshow ("Original Figure 1", srcIamge1);

	Imshow ("Original Figure 2", srcIamge2); Define the variables to be used and the class int minhassian = 400;//Define the Hessian threshold feature point detection operator Surffeaturedetector Detector (Minhassian) in the surf;// Define a Surffeaturedetector (SURF) Feature detection class object Vector<keypoint>keypoints_1, Keypoints_2;//vector template class is a dynamic array that can hold any type.
	Ability to add and compress data//call detect function to detect Surf feature key points, save in vector container Detector.detect (srcIamge1, keypoints_1);
	Detector.detect (SrcIamge2, keypoints_2);
	Draw feature keys Mat img_keypoints_1, img_keypoints_2; Drawkeypoints (srcIamge1, Keypoints_1, Img_keypoints_1, Scalar::all ( -1), Drawmatchesflags::D efault);
	 Drawkeypoints (SrcIamge2, Keypoints_2, Img_keypoints_2, Scalar::all ( -1), Drawmatchesflags::D efault);
	Display effect Figure imshow ("feature detection effect figure 1", img_keypoints_1);
	Imshow ("Feature detection effect Figure 2", img_keypoints_2);
	Waitkey (0);
return 0; }
Test results:



Tip: Because my opencv3.1.0 configuration is vs2015 under Debug x64, in order to avoid conflicts and facilitate switching, opencv2.4.13 is configured for debug Win32.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.