0: Many tutorials for installing opencv on the Internet are installed based on the source code, which is troublesome and error-prone. You only need to enter a few commands to install opencv with APT-Get, it's much more convenient (I'm a cainiao, and I'm a hacker, haha)
1: Search for opencv-related software packages:
Apt-cache search opencv
2: install these packages (I will install them all by default)
Sudo apt-Get install xxx
3: Check the installed libraries (Libraries related to opencv)
PKG-config -- cflags -- libs opencv
4: Write a small example
# Include <cv. h> # include ProgramOptional const char * filename = "temp.png"; const char * Title = "image"; iplimage * image = cvloadimage (filename, cv_load_image_color); cvnamedwindow (title, cv_window_autosize ); cvshowimage (title, image); cvwaitkey (0); cvreleaseimage (& image); cvdestroywindow (title); Return 0 ;}
5. Compile and run
GCC test. C-o Test 'pkg-config -- cflags -- libs opencv './test
Everything is done