Gesture Recognition-1: Construct the opencv environment (method 1)

Source: Internet
Author: User
Preparation Link

Opencv Official Website: http://opencv.org/

Start: http://opencv.org/quickstart.html

Cmake: http://www.cmake.org/cmake/resources/software.html (build the corresponding static dynamic library solution based on your development platform)

Numpy: http://www.numpy.org/(not required, a scientific computing library for Python)

Eigen: http://eigen.tuxfamily.org/index.php? Title = main_page # download (optional, C ++ template library for linear algebra)

Cuda: https://developer.nvidia.com/cuda-downloads (not required, can take full advantage of your GPU performance to accelerate your algorithm)

Materials

Opencv2.4.8 for Windows

Visual Studio 2012

Cmake-3.0.0 Win32

Method 1: use pre-compiled library files
  1. Decompress the downloaded opencv2.4.8 file to the specified folder. (Take D: \ opencv248 as an example)
  2. Open vs2012 and create the project testopencv. (The following is the official test code)
     1 #include <opencv2\core\core.hpp> 2 #include <opencv2\highgui\highgui.hpp> 3 #include <iostream> 4  5 using namespace cv; 6 using namespace std; 7  8 int main( int argc, char** argv ) 9 {10     if( argc != 2)11     {12      cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;13      return -1;14     }15 16     Mat image;17     image = imread(argv[1], IMREAD_COLOR); // Read the file18 19     if(! image.data ) // Check for invalid input20     {21         cout << "Could not open or find the image" << std::endl ;22         return -1;23     }24 25     namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.26     imshow( "Display window", image ); // Show our image inside it.27 28     waitKey(0); // Wait for a keystroke in the window29     return 0;30 }
  3. Open project Property Manager and create opencvdebug.

    

4. Double-click to open the opencvdebug attribute page.

(General-"Additional include directory = D: \ opencv248 \ opencv \ build \ include)

(Connector-additional library directory = D: \ opencv248 \ opencv \ build \ x86 \ vc11 \ Lib, vc11 corresponds to vs2012, other versions, and so on)

    

5. Save and compile. After compilation, run the prompt that the dll library (Runtime Library File) cannot be found ). You can add environment variables.

Add system variables (; Path = D: \ opencv248 \ opencv \ build \ x86 \ vc11 \ bin) (note the previous)

    

6. add runtime parameters (right-click Project-> properties-> Configure properties-> debug-> command parameters = D: \ myfile \ opencv \ shakila.jpg) (You can switch to the image path you want to process)

    

7. Run the compiled EXE executable file and observe the results (if any, the environment is correctly configured. If any, the configuration is incorrect)

    

Follow-up law 2

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.