vs2013+opencv3.0 No Brain Configuration method + Resolve warning issue "Windows platform"

Source: Internet
Author: User

vs2013+opencv3.0 No Brain Configuration method + Resolve warning issue "Windows platform"
This article describes how to configure the VS+OPENCV environment and resolve the OPENCV 3.0 warning C4819: The file contains characters that cannot be represented in the current code page (936). Please save the file in Unicode format to prevent data loss "warning
Reference blog:
Http://my.phirobot.com/blog/2014-02-opencv_configuration_in_vs.html
Download OpenCV

Download the latest version of OPENCV for Windows, this article is OPENCV 3.00. After double-clicking will appear decompression prompt, actually is "installs", the path fills in D:/program Files, then determines.

D:/program Files can be any of their own OPENCV installation path, after the decompression is complete, you will fill in the directory to add a OpenCV folder, which is the OpenCV of all the content. For example, according to my path, after the decompression completed OPENCV in the D:/program FILES/OPENCV inside.

Configuring Environment variables

Create a new variable inside the system variable named OPENCV , and the value is to unzip the build path under the OPENCV path, such as D:\Program files\opencv\build.

Tip

This step is convenient later if the OpenCV path changes, only need to modify this variable can be, and do not have to large scope modification.

Edit the Path variable inside the system variable and add it at the end ;%O Pencv%\x86\vc12\bin .

x86 and x64 respectively for 32bit and 64bit vs engineering, according to their own engineering to modify, or although the compilation is successful but will run errors; VC10, VC11, VC12 respectively, VS2010, VS2012, VS2013 Visual The compiler version that studio uses, according to its own vs version, fills in the correct compiler version number.
Environment variables after setting up the best to log off (restart) the system, there may be some system environment variables do not take effect immediately, resulting in a series of path-related issues.
Writing a OPENCV vs Engineering capacity attribute table

Create a new VS property sheet file opencv300.propsunder the OpenCV root directory (for example, D:\Program files\opencv) or download my opencv300.props directly (click to download) property sheet file.

The contents of the Opencv300.props file are as follows:

<?xml version= "1.0" encoding= "Utf-8"? ><project toolsversion= "4.0" xmlns= "http://schemas.microsoft.com/ developer/msbuild/2003 ">  <importgroup label=" PropertySheets "/>  <propertygroup Label=" Usermacros "/>  <PropertyGroup>    <includepath>$ (OPENCV) \include;$ ( Includepath) </IncludePath>    <librarypath condition= "' $ (Platform) ' = = ' Win32 '" >$ ( OPENCV) \x86\vc12\lib;$ (OPENCV) \x86\vc12\staticlib;$ (LibraryPath) </LibraryPath>    < LibraryPath condition= "' $ (Platform) ' = = ' X64 '" >$ (OPENCV) \x64\vc12\lib;$ (OPENCV) \x64\vc12\staticlib;$ ( LibraryPath) </LibraryPath>  </PropertyGroup>  <ItemDefinitionGroup>     <link condition= "' $ (Configuration) ' = = ' Debug ' >      < additionaldependencies>opencv_ts300d.lib;opencv_world300d.lib;ilmimfd.lib;libjasperd.lib;libjpegd.lib; Libpngd.lib;libtiffd.lib;libwebpd.lib;opencv_calib3d300d.lib;opencv_core300d.lib;opencv_features2d300d.lib;opencv_flann300d.lib;opencv_highgui300d.lib;opencv_ Imgcodecs300d.lib;opencv_imgproc300d.lib;opencv_ml300d.lib;opencv_objdetect300d.lib;opencv_photo300d.lib;o Pencv_shape300d.lib;opencv_stitching300d.lib;opencv_superres300d.lib;opencv_ts300d.lib;opencv_video300d.lib;o pencv_videoio300d.lib;opencv_videostab300d.lib;zlibd.lib;% ( additionaldependencies)       </AdditionalDependencies>    </ link>    <link condition= "' $ (Configuration) ' = = ' Release ' >      <AdditionalDependencies>opencv_ts300.lib;opencv_world300.lib;IlmImf.lib;ippicvmt.lib;libjasper.lib; Libjpeg.lib;libpng.lib;libtiff.lib;libwebp.lib;opencv_calib3d300.lib;opencv_core300.lib;opencv_ Features2d300.lib;opencv_flann300.lib;opencv_highgui300.lib;opencv_imgcodecs300.lib;opencv_imgproc300.lib;o Pencv_ml300.lib;opencv_objdetect300.lib;opencv_photo300.lib;opencv_shape300.lib;opencv_stitchiNg300.lib;opencv_superres300.lib;opencv_ts300.lib;opencv_video300.lib;opencv_videoio300.lib;opencv_ videostab300.lib;zlib.lib;% ( additionaldependencies)       </AdditionalDependencies>    </ link>  </ItemDefinitionGroup>  <itemgroup/></project>

This property sheet is opencv3.0 's VS2013 Engineering property sheet, compatible with both 64-bit and 32-bit platforms, and is compatible with debug and release configurations. Explained in detail later, the later in the VS project configuration OpenCV only need to import this property sheet.

New vs Test Engineering

Visual C + + WIN32 Console Application (input name test), new project, file

Additional options for OK---next--Choose Empty Project, complete

VS Internal Configuration OpenCV

With the VS attribute table, the OPENCV is put into the project, and each time you just add a property sheet to complete the configuration, it's much more convenient than manual interface configuration.

Property Manager, right-click "Test" (project name), add an existing property sheet

Locate the previously created or downloaded property sheet ( D:\Program files\opencv\opencv300.props ) and add the project

Test

New item, add as source file (right-click), Solution Explorer

Visual C + + file: Input name Test point add

Paste the following code to save:

#include <opencv2\opencv.hpp>#include <iostream>#include <string>UsingNamespaceCv;UsingNamespaceStd;IntMain () {mat img =  Imread ( "pp.jpg" if  (img. Empty ()) {cout <<  "error" Span class= "P"; return -1} imshow ( "nice picture of PP" img); waitkey (); return 0;}        

Rename your own photo to pp.jpg and put it in the test folder of the project (inside the test folder)

Press F5 Debug Program, if your picture came out on the OK.

Resolve warnings when compiling will appear"OPENCV 3.0 warning C4819: The file contains characters that cannot be represented in the current code page (936). Please save the file in Unicode format to prevent data loss "warning. The solution is to find the warning file and then use notepad++ to Transcode to ANSI

vs2013+opencv3.0 No Brain Configuration method + Resolve warning issue "Windows platform"

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.