最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

Install OpenCV+Qt

来源:动视网 责编:小OO 时间:2025-10-01 09:45:53
文档

Install OpenCV+Qt

InstallOpenCV1.DownloadtheOpenCV2.1.0WindowsinstallerfromSourceForge -"OpenCV-2.1.0-win32-vs2008.exe".2.Installittoafolder(withoutanyspacesinit),say"C:\\OpenCV2.1\\".Thisarticlewillrefertothispathas$openCVDir3.Duringinstallation,enabletheoption"AddO
推荐度:
导读InstallOpenCV1.DownloadtheOpenCV2.1.0WindowsinstallerfromSourceForge -"OpenCV-2.1.0-win32-vs2008.exe".2.Installittoafolder(withoutanyspacesinit),say"C:\\OpenCV2.1\\".Thisarticlewillrefertothispathas$openCVDir3.Duringinstallation,enabletheoption"AddO
Install OpenCV

1.Download the OpenCV 2.1.0 Windows installer from SourceForge - "OpenCV-2.1.0-win32-vs2008.exe".

2.Install it to a folder (without any spaces in it), say "C:\\OpenCV2.1\\". This article will refer to this path as $openCVDir

3.During installation, enable the option "Add OpenCV to the system PATH for all users".

Configure Visual Studio

1.Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories

2.Choose "Show directories for: Include files"

1.Add "$openCVDir\\include\\opencv"

3.Choose "Show directories for: Library files"

1.Add "$openCVDir\\lib"

4.Choose "Show directories for: Source files"

1.Add "$openCVDir\\src\\cv"

2.Add "$openCVDir\\src\\cvaux"

3.Add "$openCVDir\\src\\cxcore"

4.Add "$openCVDir\\src\\highgui"

Configure your Project

After you've created a project you'll need to add the OpenCV dependencies.

1.Open Project Properties: Project > %projectName% Properties...

2.Open Linker Input properties: Configuration Properties > Linker > Input

3.Open the "..." window to edit "Additional Dependencies" and on each line put:

1."cv210.lib"

2."cxcore210.lib"

3."highgui210.lib"

4.And any other lib file necessary for your project

4.Your project should now build. If you get any errors try restarting Visual Studio and then doing a clean Rebuild.

//////////////////

Install QT for VS2008 on WinXP

Posted by: asd In: C++|Code Snippet|程式設計 ()

1. 直接下載已編譯好的binary檔 QT binaries for windows,若要安裝其它較高版本 for vs2008,可到free cialis target="_blank">qt-msvc-installer下載。

2. 解壓縮後,在環境變數User Variables加入 QTDIR=C:\\Qt-4.4.3 及Path=C:\\Qt-4.4.3\\bin;.........

3. 安裝 QT for vs2008 addin

4. 在C:\\Qt-4.4.3目錄下製作兩個文字檔「configure.cache」、「.qmake.cache」,這兩個檔是build source code產生的

configure.cache

view plain

CODE:

1.-platform

2.win32-msvc2008

3.-debug-and-release

4.-platform win32-msvc2008 -debug-and-release

.qmake.cache

view plain

CODE:

1.QMAKE_QT_VERSION_OVERRIDE = 4

2.OBJECTS_DIR     = tmp\\obj\\debug_shared

3.MOC_DIR         = tmp\\moc\\debug_shared

4.RCC_DIR         = tmp\\rcc\\debug_shared

5.sql-plugins    += sqlite

6.styles         += windows plastique cleanlooks motif cde

7.imageformat-plugins += gif tiff jpeg

8.CONFIG         += dist-config large-config soft generic flagyl online  tab cialis  medium-config minimal-config small-config full-config build_all debug incremental create_prl link_prl depend_includepath QTDIR_build

9.QT_BUILD_PARTS  = libs tools examples demos docs translations

10.QMAKESPEC       = C:\\Qt-4.4.3\\mkspecs\\win32-msvc2008

11.ARCH buy cheap amoxil online             = windows

12.QT_BUILD_TREE   = C:\\Qt-4.4.3

13.QT_SOURCE_TREE review generic kamagra   = C:\\Qt-4.4.3

14.QMAKE_MOC       = $$QT_BUILD_TREE\\bin\\moc.exe

15.QMAKE_UIC       = $$QT_BUILD_TREE\\bin\xe

16.QMAKE_UIC3      = $$QT_BUILD_TREE\\bin\exe

17.QMAKE_RCC Ampicillin cheap  online  Without Prescription  buy        = $$QT_BUILD_TREE\\bin\\rcc.exe

18.QMAKE_DUMPCPP   = $$QT_BUILD_TREE\\bin\\dumpcpp.exe

19.QMAKE_INCDIR_QT = $$QT_BUILD_TREE\\include

20.QMAKE_LIBDIR_QT = $$QT_BUILD_TREE\\lib

Tags: QT

////////////////

-platform

win32-msvc2008

-debug-and-release

-platform win32-msvc2008 -debug-and-release

/////////////////

QMAKE_QT_VERSION_OVERRIDE = 4

OBJECTS_DIR     = tmp\\obj\\debug_shared

MOC_DIR         = tmp\\moc\\debug_shared

RCC_DIR         = tmp\\rcc\\debug_shared

sql-plugins    += sqlite

styles         += windows plastique cleanlooks motif cde

imageformat-plugins += gif tiff jpeg

CONFIG         += dist-config large-config soft generic flagyl online  tab cialis  medium-config minimal-config small-config full-config build_all debug incremental create_prl link_prl depend_includepath QTDIR_build

QT_BUILD_PARTS  = libs tools examples demos docs translations

QMAKESPEC       = C:\\Qt-4.4.3\\mkspecs\\win32-msvc2008

ARCH buy cheap amoxil online             = windows

QT_BUILD_TREE   = C:\\Qt-4.4.3

QT_SOURCE_TREE review generic kamagra   = C:\\Qt-4.4.3

QMAKE_MOC       = $$QT_BUILD_TREE\\bin\\moc.exe

QMAKE_UIC       = $$QT_BUILD_TREE\\bin\xe

QMAKE_UIC3      = $$QT_BUILD_TREE\\bin\exe

QMAKE_RCC Ampicillin cheap  online  Without Prescription  buy        = $$QT_BUILD_TREE\\bin\\rcc.exe

QMAKE_DUMPCPP   = $$QT_BUILD_TREE\\bin\\dumpcpp.exe

QMAKE_INCDIR_QT = $$QT_BUILD_TREE\\include

QMAKE_LIBDIR_QT = $$QT_BUILD_TREE\\lib

////////////////////////////////////

安裝VC(我選擇 visual studio 2008 Express,只安裝VC)

下載 qt-win-opensource-src-4.4.3.zip

解壓縮到C:\\Qt-4.4.3 (這個路徑位置,聽說不能有空白,不知道新的版本有沒有修正,提醒一下)

2.編譯Qt 4.4.3

可以參考目錄裡的README和INSTALL檔案,就和我現在寫的差不多....

選取開始->程式集->visual studio 2008-> vs 2008 tools-> vs 2008 command promt,

輸入configure -platform win32-msvc2008[Enter],

PS:基本上,只要環境單純,上一步驟所開啟的console視窗,會設定好Path, LIB, INCLUDE的環境變數,因此不需要 -platform win32-msvc2008 這個參數,就可以偵測使用vc2008的編譯器和函式庫,

但如果有安裝別的編譯器,可能會附加一些路徑,在這些環境變數,導致錯亂...

輸入nmake,然後等等等等.....

3.設定visual studio 

開始->控制台->系統->進階->環境變數,

設定QTDIR=C:\\qt-4.4.3\\ ,只是字串代換,後面的設定不會落落長

設定Path=%QTDIR%bin;%Path%,為了讓產生的執行檔能夠找到需要的DLL

啟動VC 的IDE

檔案->新增->專案,選取"一般"->"Makefile 專案填入專案名稱...

然後下一步

建置命令列: qmake -project&&qmake&&nmake debug

清除命令: nmake debug-clean

重建命令: qmake -project&&qmake&&nmake debug

建置命令列: qmake -project&&qmake&&nmake release

清除命令: nmake release-clean

重建命令: qmake -project&&qmake&&nmake release

工具->選項->專案和方案->VC++ 目錄,切換顯示目錄到"可執行檔增加$(QTDIR)\\bin

工具->選項->專案和方案->VC++ 目錄,切換顯示目錄到"Include檔案增加$(QTDIR)\\include\\...

工具->選項->專案和方案->VC++ 目錄,切換顯示目錄到"程式庫檔增加$(QTDIR)\\lib

工具->選項->專案和方案->VC++ 目錄,切換顯示目錄到"原始程式檔增加$(QTDIR)\\Src

專案->test_qt1屬性->組態屬性->偵錯

PS1: 修改"命令"為$(TargetDir)Debug\\$(TargetFileName),是讓偵錯時,能找到執行檔,至於巨集,是在這個IDE內專屬的,

專案->加入新項目->程式碼->C++ 檔(.cpp),新加一個檔(例如main.cpp)

找個簡單的程式,測試一下,例如Hello world!!!

Qt Tutorial

建置->建置方案 (F7)

偵錯->開始偵錯 (F5)

偵錯->啟動但不偵錯 (Ctrl+F5)

Trolltech也有提供visual C++的plugin,不過好像要商業版才有,這裡有比較,這個安裝算是實驗性質,我是覺得,如果使用VC,那以後真的有跨平台的需求,我想應該不會有Linux版的VC吧...

///////////////////////////

1. 安装Qt libraries for Windows (VS 2008) ,下到的是qt-win-opensource-4.6.2-vs2008.exe,QT已经提供了使用VS2008编译的版本,这样就不需要再费几个小时来编译环境。

2. 安装Visual Studio Add-in,此处要下载1.1.3版,我之前下载了最新的1.1.4版,但出现了很多错误。1.1.3下载地址是http://get.qt.nokia.com/vsaddin/qt-vs-addin-1.1.3.exe

3. 现在打开VS2008,新建项目时就会出现QT4 Project这一项。菜单栏也会出现QT菜单。

==========================

如果VS Add-in安装的是1.1.4版本,可能会出现以下问题:

1. 点击新建项目中的ui文件不会打开QT Designer,是个比较大的问题。

我找了一个临时解决方法,虽然不明白道理:在ui文件上右键-打开方式,这时弹出框中会有两个QT Designer,选择另一个就可以正常启动了。

 

2. 另外出现另一个问题,点击QT菜单中的Launch Designer,会出现如下错误:

找不到方法:“Boolean System.Threading.WaitHandle.WaitOne(Int32)”。 

Stacktrace: 在 Qt4VSAddin.ExtLoader.loadDesigner(String fileName) 在 Qt4VSAddin.Connect.Exec(String commandName, vsCommandExecOption executeOption, Object& varIn, Object& varOut, Boolean& handled)

这个问题到现在仍未解决。希望如果有网友能够找到方法,能够提供给我。

这些问题在安装1.1.3版之后全部消除,如果你也遇到这些问题,可以尝试下载旧版本。

文档

Install OpenCV+Qt

InstallOpenCV1.DownloadtheOpenCV2.1.0WindowsinstallerfromSourceForge -"OpenCV-2.1.0-win32-vs2008.exe".2.Installittoafolder(withoutanyspacesinit),say"C:\\OpenCV2.1\\".Thisarticlewillrefertothispathas$openCVDir3.Duringinstallation,enabletheoption"AddO
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top