跳到主要內容

Opencv : Building the OpenCV 2.2 library using CMake

Building the OpenCV 2.2 library using CMake

1. Install CMake
2. Start the CMake GUI from Start menu
3. Select:
* Where is the source code: (the directory where CMakeLists.txt in OpenCV is stored), eg: "C:\Program Files\OpenCV2.2"
* Where to build the binaries: (the directory where the OpenCV library will be built), eg: "C:\Program Files\OpenCV2.2\build"
4. Press Configure and select Visual Studio 2008 or 2010 project.
5. Enter any parameters, like if you want to build Python bindings, documentation, shared libraries, use TBB, CUDA, Eigen2 libraries, etc. (Note that TBB, 64-bit and CUDA may still be under development and therefore buggy)
6. Repeat pressing Configure until no more red rows are highlighted.
7. When ready, press Generate.
8. Open the "build" directory, where you will find your VS2008 or VS2010 "sln" file.
9. Open the sln file in VS2008 or VS2010, and Built the Solution. This should compile the OpenCV 2.2 library into the build folder.

Building your own projects using OpenCV 2.2 in Visual Studio

After you have compiled the OpenCV 2.2 library using CMake, you should configure your Visual Studio projects to use OpenCV:

1. Create your new project for C++
2. Go to project properties
3. Go to VC++ Directories
4. Add 2 new Include Directories (it's the path where you installed OpenCV, include folder):
* C:\Program Files\OpenCV2.2\include
* C:\Program Files\OpenCV2.2\include\opencv
5. Add 1 new Library Directory (it's the path where you installed OpenCV, lib folder):
* C:\Program Files\OpenCV2.2\lib
6. Go to Linker in the left menu and select Input option
7. Add these entries on Additional Dependencies option:
* C:\Program Files\OpenCV2.2\lib\opencv_core220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_highgui220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_video220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_ml220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_legacy220d.lib
* C:\Program Files\OpenCV2.2\lib\opencv_imgproc220d.lib
8. Make the content of 'OpenCV_Helloworld.cpp' as such:
#include "cv.h"等,但是備註修改為 #include "opencv2/imgproc/imgproc.hpp"
ERROR C1083
Visual C++ >>include 目錄
C:\OpenCV2.2\include\opencv;C:\OpenCV2.2\vs2010\include\;

留言

這個網誌中的熱門文章

C 和 C++ 的 Callback

C Callback Function with C++ Class 轉載於: http://lak4cyut.blogspot.tw/2008/08/c-callback-function-with-class.html 由於 C/C++ 語言的特性,許多 API 是必需要利用 Callback function 才能完成作用 在 C 的時代這是很合理也很直覺化的設計,但若將場景拉到 C++ 呢.... --此篇除了介紹 How 之外,也將對 Why 進行簡單的介紹,希望能夠令不知其所以然的人有所幫助。-- Effective C++m 一書將 C++ 視為一種語言聯邦,而其中最簡單及常被討論到的,我想大概是屬於 OOP 的部份。 在 C++ 中利用 Class 來實現 OO 的許多精神,許多的程式設計都會採用 OO 的封裝特性,也因此當你需要使用某些 API 時,會面臨到 callback function 設計不易的問題。包括如何取用物件內的屬性、如何將物件傳入等問題,假設利用 non-member function 來設計 callback function,為了能令 callback function 順利的存取相關的物件內的資料,可能會在某種程度上破壞掉物件的封裝性。 因此,若以封裝性的角度來看,我們當然會希望能夠直覺的以 class member function 來做為 callback function,如此一來,便可以在不破壞封裝性的情況下,依然順利的使用物件內的屬性。 在這個前提下,便會很直覺的寫出以下的程式段: class CMyClass { public: void Mainfunc() ; void CBfunc(void *) ; private: int iData ; int iInc ; } int CMyClass::CBfunc(void *iIncLoc) { int _i = (int)iIncLoc ; return iData+_i ; } void CMyClass::Mainfunc() { // APIfunc( *pCallback, *pParam) <-- br=""> APIfunc(CBfunc, i

難捨

每次星期天要和你道別的時候,心中總是有很多不捨。 只能告訴自己,很快的又能見面了。 在擁擠的火車上,思念還是停留在妳的身上。 那時深深的覺得,有一個能夠去呵護而值得愛的人,是一種幸福。

.NET操作EXCEL時出現的錯誤

  在免部署 Office PIAs (Primary Interop Assemblies) 的情況下存取 Office 物件模型 (以下轉載) Microsoft::Office::Interop::Excel::ApplicationClass ^app  = gcnew Microsoft::Office::Interop::Excel::ApplicationClass(); Microsoft::Office::Interop::Excel::WorkbookClass ^wrk = app->Workbooks->Add() ASP.NET操作EXCEL時出現的錯誤 Retrieving the COM class factory for component with CLSID(轉) 解決方案: 運行dcomcnfg打開組件服務 依次展開"組件服務"->"計算機"->"我的電腦"->"DCOM配置" 找到"Microsoft Excel應用程序" 右鍵打開屬性對話框,點擊"標識"選項卡 點"下列用戶",把管理員的用戶密碼正確填寫進去... 點擊"安全"選項卡, 依次把"啟動和激活權限","訪問權限","配置權限",都選擇為自定義, 然後依次點擊它們的編輯,把everyone添加進去,並加入所有的權限... OK,解決此問題! MMC是以x64來執行的,它會排除掉x32的DCOM伺服器,如下,看不到Microsoft Excel Application 解決方式也很容易,就是要以x32方式執行MMC已開啟元件服務,我們知道元件服務是"comexp.msc"這個描述檔後, 只要在開始工具列-->執行 如下命令: mmc comexp.msc /32