Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I ran into some difficulty as well - the documentation is just slightly out of date. </p> <p>This solution is based on this tutorial: <a href="http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010_CMake" rel="nofollow">http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010_CMake</a></p> <p>Here's the exact steps I took to get an opencv 2.4.2 hello world example working with Visual C++ 2010 Express:</p> <p><strong>Grab the source code</strong></p> <p>Download opencv.</p> <p>Extract opencv to C:\</p> <p><strong>Building the binaries</strong></p> <p>Download cmake. Open the cmake gui..</p> <p>Where is the source code: C:/opencv</p> <p>Where to build the binaries: C:/opencv/build</p> <p>Click Configure - for the generator choose Visual Studio 10 Click Generate.</p> <p>In C:\opencv\build you should now see OpenCV.sln.</p> <p>Open the solution file with VS C++ Express and build it.</p> <p><strong>Setting up the hello world project</strong></p> <p>Create a new project in VS. Choose console application and leave precompiled headers ticked. Right-click on solution file and choose properties.</p> <p>In the VC++ Directories window, add the following:</p> <p>Include Directories: C:\opencv\build\include;C:\opencv\build\include\opencv;C:\opencv\build\include\opencv2</p> <p>Library Directories: C:\opencv\build\lib\Debug</p> <p>Source Directories: C:\opencv\build\include</p> <p>In C++ -> Linker -> Input, add the following to Additional Dependencies:</p> <pre><code>opencv_core242d.lib opencv_highgui242d.lib </code></pre> <p><strong>Hello World Content</strong></p> <p>Change the content as suggested in the tutorial to:</p> <pre><code>#include "stdafx.h" #include &lt;cv.h&gt; #include &lt;cxcore.h&gt; #include &lt;highgui.h&gt; int _tmain(int argc, _TCHAR* argv[]) { IplImage *img = cvLoadImage("funny-pictures-cat-goes-pew.jpg"); cvNamedWindow("Image:",1); cvShowImage("image:",img); cvWaitKey(); cvDestroyWindow("Image:"); cvReleaseImage(&amp;img); return 0; } </code></pre> <p>Place the image (or any image) in your project directory.</p> <p>Now build and hit Debug, and it should work. Hope this helps someone.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload