OpenCV learning notes (1) install and set and display images

Source: Internet
Author: User
Tags microsoft website

20091027-Update:

For how to install OpenCV2.0 in VS2008, see 《Install OpenCV2.0 in VC 2008 Express.

 

1. OpenCV: http://sourceforge.net/projects/opencvlibrary/

2. Useful Websites:

(1) Visit OpenCV Wikipedia-pages at http://opencv.willowgarage.com/wiki/ and look for the information there (and/or add it when you have found a solution)
(2) Search through OpenCV archives at www.yahoogroups.com (http://groups.yahoo.com/group/OpenCV)
(3) Join OpenCV mailing list at yahoo groups (see FAQs on how to do it) and mail your questions (the mailing list will probably migrate to OpenCV's SourceForge site http://www.sourceforge.net/projects/opencvlibrary)
(4) Look at the OpenCV sample code, read the reference manual (http://opencv.willowgarage.com/documentation/index.html)
OpenCV Chinese website: http://www.opencv.org.cn

I. program installation settings

1. After OpenCV is installed, check whether C:/Program Files/OpenCV1.2/bin has been added to the environment variable PATH. If not, add it. (My computer -- Property -- Advanced -- Environment Variable-*** user variable -- select the 'path' variable and click 'edit ', add 'C:/Program Files/OpenCV1.2/bin' at the end of the 'variable value' column ').

After you sign in, You need to log out of the current Windows user (or restart) and then log in again to take effect (you can also terminate the assumer.exe process through the task manager, and then re-run the assumer.exe process ).

2. Download and install Microsoft Visual C ++ 2008 Redistributable
During OpenCV1.2 compilation in VS2005, the following error may occur ('application Initialization is normal (0xc0150002 failed )'):

Download and install Microsoft Visual C ++ 2008 Redistributable from the official Microsoft website. Generally, this problem can be solved:
Http://www.microsoft.com/downloads/thankyou.aspx? FamilyId = a5c84275-3b97-4ab7-a40d-3802b2af5fc2 & displayLang = zh-cn

For more information about how to compile OpenCV after installation, visit the OpenCV Chinese Forum:
Http://www.opencv.org.cn/forum/viewtopic.php? F = 1 & t = 4299

3. Configure the Visual Studio 2005
(1) Global Options
-- Open Microsoft Visual Studio 2005 and choose Tools> Options.
-- In the displayed window, select Projects and Solutions-> VC ++ Directories

-- First, select "Library files" from the "Show Directories for" drop-down menu"
-- In the library file list, locate and add: C:/Program Files/OpenCV1.2/lib

-- Then, select "Include files" from the "Show Directories for" drop-down menu"
-- In the list of included Files, locate and add: C:/Program Files/OpenCV1.2/include/opencv

-- Select "Source files" from the "Show Directories for" drop-down menu"
-- In the list of included files, locate and add:
C:/Program Files/OpenCV1.2/src/cv
C:/Program Files/OpenCV1.2/src/cvaux
C:/Program Files/OpenCV1.2/src/cxcore
C:/Program Files/OpenCV1.2/src/highgui
C:/Program Files/OpenCV1.2/src/ml

Press OK to save

(2) create an OpenCV Project
-- Create a Win32 Console Project

-- Set the lib required by the project
Choose Project> Properties> Configuration Properties> Linker> Input
Add the required libraries such as cxcore120.lib cv120.lib ml120.lib cvaux120.lib highgui120.lib cxts120.lib to additional dependencies.

2. A simple getting started Program-displaying images

The Code is as follows:

Note: After debugging is complete, you should place the original image in the Debug folder of the project folder so that the image and the exe program are in the same folder, in order to correctly read and display the image when running the program.

P.S.: A Source Control error may be prompted when you exit VS2005. You can solve this problem as follows:
Tools-> Options-> Source Control-> Plug-in Selection, select none in Current source control plug-in.

In addition, when a csdn blog is writing an article, if you start a new paragraph by pressing enter, the spacing between the paragraphs is large and not very beautiful, and can be replaced by shift + enter, in this way, the spacing between paragraphs is the same as that between paragraphs.

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.