• Open Source Computer Vision Library

VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

OpenCV使用问题:如函数调用,编译出错等

版主: chai2010, ollydbg23, bebekifis

VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子Shiqi Yu » 2009-10-24 15:50

看到很多朋友使用OpenCV2.0遭遇了困难,我写了一个《VC 2008 Express下安装OpenCV2.0》教程
http://www.opencv.org.cn/index.php/VC_2 ... 5OpenCV2.0

VC2005的编译方法应该与这个类似,没有太大差别。
VC6可能有问题,还没有测试。
1. 发帖时请详细描述您遇到的问题,不要仅仅用“出错”,“有问题”,“不行”等没有信息含量的描述。
2. 标题中扼要描述你的问题,不要用“新手请教”之类没有信息含量的标题。
3. 不要“哭求”,“跪求”,男儿有泪不轻弹,男儿膝下有黄金。
4. 技术问题请发在板面,不要给我发送私人短信,其他问题欢迎给我发信。
头像
Shiqi Yu
站点管理员
 
帖子: 2119
注册: 2006-09-27 17:58
地址: 蛇口

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子dake53 » 2009-10-26 19:06

好东西 收藏了 :D
头像
dake53
OpenCV本科生
 
帖子: 110
注册: 2008-09-22 13:50

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子ollydbg23 » 2009-10-29 9:05

赞Yu老大的工作!教程写的很不错!图文并茂!!虽然我自己不用VC2008express,呵呵。
本人不接受站内私人短信讨论技术问题,有问题请发贴讨论!!!
提问的智慧 OpenCV论坛中文搜索 论坛精华区
头像
ollydbg23
OpenCV教授
 
帖子: 2584
注册: 2008-04-13 9:16

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子Shiqi Yu » 2009-10-29 10:01

ollydbg23 写道:赞Yu老大的工作!教程写的很不错!图文并茂!!虽然我自己不用VC2008express,呵呵。

如果使用VC2005, VC2008,编译方法应该完全相同。
用VC6没有编译成功,OpenCV INSTALL文档没有提到支持VC6,也没有去仔细研究为什么,用VC6的人要郁闷了。
1. 发帖时请详细描述您遇到的问题,不要仅仅用“出错”,“有问题”,“不行”等没有信息含量的描述。
2. 标题中扼要描述你的问题,不要用“新手请教”之类没有信息含量的标题。
3. 不要“哭求”,“跪求”,男儿有泪不轻弹,男儿膝下有黄金。
4. 技术问题请发在板面,不要给我发送私人短信,其他问题欢迎给我发信。
头像
Shiqi Yu
站点管理员
 
帖子: 2119
注册: 2006-09-27 17:58
地址: 蛇口

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子ollydbg23 » 2009-10-29 23:39

VC6下面搞OpenCV2.0感觉不行,因为VC6的编译器太老了。。。
本人不接受站内私人短信讨论技术问题,有问题请发贴讨论!!!
提问的智慧 OpenCV论坛中文搜索 论坛精华区
头像
ollydbg23
OpenCV教授
 
帖子: 2584
注册: 2008-04-13 9:16

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子hqhuang1 » 2009-11-03 15:31

谢谢,辛苦了~!
追求卓越,From common to great
头像
hqhuang1
OpenCV本科生
 
帖子: 167
注册: 2009-08-05 19:44

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子DanielDuan » 2009-11-04 14:28

刚下了2.0,正好能用上这个教程,多谢了
DanielDuan
OpenCV幼儿园宝宝
 
帖子: 2
注册: 2009-10-16 10:55

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子seigeweapon » 2009-11-06 16:00

我按lz的教程走的,结果在Cmake一步就不对了:
点Generate按钮后提示:Error in generation process, project files may be invalid.
提示框里的信息:
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.6)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.


Configuring done
Generating done
CMake Error: Unknown Target referenced : opencv_lapack
CMake Error: Target: cxcore depends on unknown target: opencv_lapack
CMake Error: Unknown Target referenced : zlib
CMake Error: Target: cxcore depends on unknown target: zlib


是什么问题呢,请指教。
seigeweapon
OpenCV幼儿园宝宝
 
帖子: 3
注册: 2009-11-06 15:11

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子gogo00007 » 2009-11-07 18:24

不知道你的默认编译器是否是你选择的(例子中是VS2008),另外检查cmake的版本是否符合要求,个人意见,仅供参考


seigeweapon 写道:我按lz的教程走的,结果在Cmake一步就不对了:
点Generate按钮后提示:Error in generation process, project files may be invalid.
提示框里的信息:
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.6)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.


Configuring done
Generating done
CMake Error: Unknown Target referenced : opencv_lapack
CMake Error: Target: cxcore depends on unknown target: opencv_lapack
CMake Error: Unknown Target referenced : zlib
CMake Error: Target: cxcore depends on unknown target: zlib


是什么问题呢,请指教。
gogo00007
OpenCV初中生
 
帖子: 35
注册: 2009-07-23 14:40

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子seigeweapon » 2009-11-09 9:38

我使用的VS2008 专业版,不是Express,难道是这个个原因?
Cmake我是从教程给的链接下载的,版本是cmake-2.6.4-win32-x86.exe,应该是最新版了吧?


gogo00007 写道:不知道你的默认编译器是否是你选择的(例子中是VS2008),另外检查cmake的版本是否符合要求,个人意见,仅供参考


seigeweapon 写道:我按lz的教程走的,结果在Cmake一步就不对了:
点Generate按钮后提示:Error in generation process, project files may be invalid.
提示框里的信息:
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 2.6)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.


Configuring done
Generating done
CMake Error: Unknown Target referenced : opencv_lapack
CMake Error: Target: cxcore depends on unknown target: opencv_lapack
CMake Error: Unknown Target referenced : zlib
CMake Error: Target: cxcore depends on unknown target: zlib


是什么问题呢,请指教。
seigeweapon
OpenCV幼儿园宝宝
 
帖子: 3
注册: 2009-11-06 15:11

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子Shiqi Yu » 2009-11-09 10:52

估计用cmake的时候,路径设置有问题,
再仔细看看教程。
1. 发帖时请详细描述您遇到的问题,不要仅仅用“出错”,“有问题”,“不行”等没有信息含量的描述。
2. 标题中扼要描述你的问题,不要用“新手请教”之类没有信息含量的标题。
3. 不要“哭求”,“跪求”,男儿有泪不轻弹,男儿膝下有黄金。
4. 技术问题请发在板面,不要给我发送私人短信,其他问题欢迎给我发信。
头像
Shiqi Yu
站点管理员
 
帖子: 2119
注册: 2006-09-27 17:58
地址: 蛇口

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子seigeweapon » 2009-11-09 11:48

已解决,果然是cmake路径写的不对,谢谢了
seigeweapon
OpenCV幼儿园宝宝
 
帖子: 3
注册: 2009-11-06 15:11

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子shihyu » 2009-11-17 2:31

在Debug下,選擇Solution Explorer里的 Solution OpenCV,點右鍵,運行"Rebuild Solution"

出現下面錯誤

20>cv.cpp
20>c:\opencv2.0\include\opencv\cvcompat.h(803) : warning C4819: 檔案含有無法在目前字碼頁 (950) 中表示的字元。請以 Unicode 格式儲存檔案以防止資料遺失
20>正在將資訊清單編譯至資源...
20>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
20>Copyright (C) Microsoft Corporation. All rights reserved.
20>正在連結...
20>LINK : fatal error LNK1104: 無法開啟檔案 'python26_d.lib'
20>已將建置記錄儲存於 "file://c:\OpenCV2.0\vc2008\interfaces\python\cvpy.dir\Debug\BuildLog.htm"
20>cvpy - 1 個錯誤,1 個警告
shihyu
OpenCV幼儿园宝宝
 
帖子: 2
注册: 2009-11-17 2:27

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子sjlong726 » 2009-11-22 23:46

hao dong xi shoucang
sjlong726
OpenCV幼儿园宝宝
 
帖子: 1
注册: 2009-11-22 23:42

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子fmarch » 2009-11-24 15:49

我在cmake的时候产生错误
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE):
The C compiler "C:/Program Files/Microsoft Visual Studio/VC98/Bin/CL.EXE"
is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Documents and Settings/Administrator/My Documents/Cmake/CMakeFiles/CMakeTmp



Run Build Command:C:\PROGRA~1\MICROS~3\Common7\IDE\devenv.com
CMAKE_TRY_COMPILE.sln /build Debug /project cmTryCompileExec
请问是怎么回事儿啊 路径什么的都没有问题啊
fmarch
OpenCV幼儿园宝宝
 
帖子: 2
注册: 2009-11-24 15:45

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子susiel » 2009-11-24 22:29

seigeweapon 写道:已解决,果然是cmake路径写的不对,谢谢了

我也出现了这个问题 怎么解决的啊 是按那图一步一步来的啊 cmake路径是哪个?
susiel
OpenCV幼儿园宝宝
 
帖子: 4
注册: 2009-11-24 22:20

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子susiel » 2009-11-24 22:45

解决了。。。
cmake路径应该是D:/Program Files/OpenCV2.0
而不是D:/Program Files/OpenCV2.0/src
susiel
OpenCV幼儿园宝宝
 
帖子: 4
注册: 2009-11-24 22:20

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子Shiqi Yu » 2009-11-25 9:10

susiel 写道:解决了。。。
cmake路径应该是D:/Program Files/OpenCV2.0
而不是D:/Program Files/OpenCV2.0/src

看教程不仔细啊
1. 发帖时请详细描述您遇到的问题,不要仅仅用“出错”,“有问题”,“不行”等没有信息含量的描述。
2. 标题中扼要描述你的问题,不要用“新手请教”之类没有信息含量的标题。
3. 不要“哭求”,“跪求”,男儿有泪不轻弹,男儿膝下有黄金。
4. 技术问题请发在板面,不要给我发送私人短信,其他问题欢迎给我发信。
头像
Shiqi Yu
站点管理员
 
帖子: 2119
注册: 2006-09-27 17:58
地址: 蛇口

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子susiel » 2009-11-25 9:39

又有了新问题。。
按教程里的需要build,生成需要调用的opencv库。是.dll的动态库,也有.lib的静态库
可是opencv的安装目录bin下有现有的.dll动态库,为什么不直接用dll的动态库呢? 而用build之后的.lib静态库呢?我直接用现有.dll的话 就会出错

错误是:
------ Build started: Project: face_pic, Configuration: Debug Win32 ------
1>Compiling...
1>face_pic.cpp
1>c:\program files\microsoft visual studio 8\vc\include\cvcompat.h(785) : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(53) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(54) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(58) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(58) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(63) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(63) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(64) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(64) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(66) : error C2146: syntax error : missing ';' before identifier 'imread'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(66) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(67) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(67) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(68) : error C2059: syntax error : ')'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(68) : error C2143: syntax error : missing ')' before ';'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(69) : error C2146: syntax error : missing ';' before identifier 'imdecode'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(69) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(69) : error C2086: 'int cv::Mat' : redefinition
1> c:\program files\opencv2.0\project\include\opencv\highgui.hpp(66) : see declaration of 'cv::Mat'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(69) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(69) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(69) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(70) : error C2143: syntax error : missing ',' before '&'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(72) : error C2059: syntax error : ')'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(72) : error C2143: syntax error : missing ')' before ';'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(78) : error C2143: syntax error : missing ';' before '<'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(78) : error C2182: 'Ptr' : illegal use of type 'void'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(78) : error C2433: 'Ptr' : 'inline' not permitted on data declarations
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(78) : error C2988: unrecognizable template declaration/definition
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(78) : error C2059: syntax error : '<'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(78) : error C2039: 'delete_obj' : is not a member of '`global namespace''
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(81) : error C2039: 'delete_obj' : is not a member of '`global namespace''
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(82) : error C2143: syntax error : missing ';' before '{'
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(82) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\program files\opencv2.0\project\include\opencv\highgui.hpp(126) : fatal error C1506: unrecoverable block scoping error
1>Build log was saved at "file://d:\liang\myPrac\hello\face_pic\Debug\BuildLog.htm"
1>face_pic - 39 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

以前用1.1时 原来的工程没有出现这样的问题,换了2.0之后就出现了
susiel
OpenCV幼儿园宝宝
 
帖子: 4
注册: 2009-11-24 22:20

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子fmarch » 2009-11-25 13:44

我按照教程运行例子的时候 总是报错 说是 Cannot open include file: 'highgui.h': No such file or directory
请问各位这是怎么回事呢
fmarch
OpenCV幼儿园宝宝
 
帖子: 2
注册: 2009-11-24 15:45

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子Shiqi Yu » 2009-11-25 15:06

include path设置错误

fmarch 写道:我按照教程运行例子的时候 总是报错 说是 Cannot open include file: 'highgui.h': No such file or directory
请问各位这是怎么回事呢
1. 发帖时请详细描述您遇到的问题,不要仅仅用“出错”,“有问题”,“不行”等没有信息含量的描述。
2. 标题中扼要描述你的问题,不要用“新手请教”之类没有信息含量的标题。
3. 不要“哭求”,“跪求”,男儿有泪不轻弹,男儿膝下有黄金。
4. 技术问题请发在板面,不要给我发送私人短信,其他问题欢迎给我发信。
头像
Shiqi Yu
站点管理员
 
帖子: 2119
注册: 2006-09-27 17:58
地址: 蛇口

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子susiel » 2009-11-25 16:23

找到错误了。。
原来highgui.h路径设置有问题,还是原来版本的文件,可是highgui.hpp确是新版本的,冲突了
susiel
OpenCV幼儿园宝宝
 
帖子: 4
注册: 2009-11-24 22:20

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子conanlrj » 2009-11-28 23:45

为什么我用Cmake老是出现这个问题呢?去Google了一下也没什么发现,有遇到同类问题解决了的高手么?

Check for working C compiler: cl
Check for working C compiler: cl -- broken
CMake Error at D:/conan/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:50 (MESSAGE):
The C compiler "cl" is not able to compile a simple test program.

It fails with the following output:

Change Dir: D:/conan/OpenCV2.0/vs2008/CMakeFiles/CMakeTmp
conanlrj
OpenCV幼儿园宝宝
 
帖子: 3
注册: 2009-10-27 23:11

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子leezhm » 2009-11-30 16:55

我在vs 2008下面成功了,但是在codeblock下怎么也没成功,老是出现如下错误:

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:C:/Documents and Settings/Leezhm/Desktop/opencv_2.0/CodeBlocks/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:C:/Documents and Settings/Leezhm/Desktop/opencv_2.0/CodeBlocks/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Configuring incomplete, errors occurred!
leezhm
OpenCV小学生
 
帖子: 15
注册: 2009-11-30 16:45

Re: VC 2008 Express下安装OpenCV2.0 【图文并茂手把手教程】

帖子cver » 2009-12-01 7:42

干得不错,赞!

不过把OpenCV文档中自带的例程当做楼主自己提供的有点不厚道
cver
OpenCV小学生
 
帖子: 6
注册: 2009-11-29 11:48

下一页

回到 OpenCV新兵

在线用户

正在浏览此版面的用户:Google [Bot], Yahoo [Bot] 和 8 位游客