Friday, November 25, 2005

[OpenCV] Install OpenCV for VC6.0

Install OpenCV for VC6.0
OpenCV is one kind of library designed for Computer Vision and is released by Intel Corp. . It includes more than 300 most usually used algorithm in Image Processing, but from now on, it only supports C/C++. The related information is below:
http://www.intel.com/research/mrl/research/opencv/index.htm#press
And the related Chinese link:
http://www.assuredigit.com/forum/display_topic_threads.asp?ForumID=11&TopicID=3471&PagePosition=1
 
Download OpenCV Lib
The first step you need to do is to download the OpenCV Lib, also you can download here:
http://sourceforge.net/projects/opencvlibrary/
or you can download from my website: OpenCV Beta4.0 [Now is OpenCV Beta5.0 ]
The second step you need to do is download the DirectX form the Microsoft website:
http://msdn.microsoft.com/directx
or you can download form my website: DirectX 9.0c (It's a little big.)
 
After installing the Lib, you may go to the root folder of the OprnCV, and if you didn't change any kind of configuration, the destination may be here:
C:\Program Files\OpenCVThen go to the C:\Program Files\OpenCV\docs\faq.htm
You can solve lots of question by your self from here, but......not sure for every problem....
Recompile OpenCV Lib
Go to the C:\Program Files\OpenCV\_make and you will find opencv.dsw (opencv.sln). Open it and recompile it in Win32 Debug and Release mode and you will get
the lib you need in C:\Program Files\OpenCV\lib
* Don't know how to compile? Just ask your friends or your classmates.
Set the Environment Variable
In the "System Environment Variable" table find the "Path" variable and add this "C:\Program Files\OpenCV\bin" in it.
*The environment variable can be found in "My Computer" .

Customize your project
Whenever you create a new project, you should do follow customization by yourself, or you can't use the OpenCV Lib.
The steps below are collected in faq.htm and plus my little modification.
Customize project settings:
Activate project setting dialog by choosing menu item "Project"->"Settings...".
Select your project in the right pane.
Tune settings, common to both Release and Debug configurations:
Select "Settings For:"->"All Configurations"
Choose "C/C++" tab -> "Preprocessor" category -> "Additional Include Directories:". Add comma-separated relative (to the .dsp file) or absolute paths: (C:\Program Files\OpenCV\cxcore\include,C:\Program Files\OpenCV\cv\include,C:\Program Files\OpenCV\otherlibs\highgui,C:\Program Files\OpenCV\cvaux\include)
Choose "Link" tab -> "Input" category -> "Additional library path:". Add the paths to all neccessary import libraries (cxcore[d].lib cv[d].lib hihghui[d].lib cvaux[d].lib) like: (C:\Program Files\OpenCV\lib\CVd.lib,C:\Program Files\OpenCV\lib\cxcore.lib,C:\Program Files\OpenCV\lib\cxcored.lib,C:\Program Files\OpenCV\lib\cv.lib,C:\Program Files\OpenCV\lib\highgui.lib,C:\Program Files\OpenCV\lib\highguid.lib,C:\Program Files\OpenCV\lib\cvaux.lib,C:\Program Files\OpenCV\lib\cvauxd.lib)
Tune settings for "Debug" configuration
Select "Settings For:"->"Win32 Debug".
Choose "Link" tab -> "General" category -> "Object/library modules". Add "C:\Program Files\OpenCV\lib\CVd.lib" "C:\Program Files\OpenCV\lib\HighGUId.lib" "C:\Program Files\OpenCV\lib\cvauxd.lib" "C:\Program Files\OpenCV\lib\cxcored.lib" (optionally)
You may also want to change location and name of output file. For example, if you want the output .exe file to be put into the project folder, rather than Debug/ subfolder, you may type ./d.exe in "Link" tab -> "General" category -> "Output file name:".
Tune settings for "Release" configuration
Select "Settings For:"->"Win32 Release".
Choose "Link" tab -> "General" category -> "Object/library modules". Add "C:\Program Files\OpenCV\lib\cv.lib" "C:\Program Files\OpenCV\lib\HighGUI.lib" "C:\Program Files\OpenCV\lib\cvaux.lib" "C:\Program Files\OpenCV\lib\cxcore.lib" (optionally)
Optionally, you may change name of the .exe file: type ./.exe in "Link" tab -> "General" category -> "Output file name:".
Add dependency projects into workspace:
Choose from menu: "Project" -> "Insert project into workspace".
Select "C:\Program Files\OpenCV\cv\src\cv.dsp".
Do the same for "C:\Program Files\OpenCV\cxcore\src\cxcore.dsp", "C:\Program Files\OpenCV\cvaux\src\cvaux.dsp", "C:\Program Files\OpenCV\otherlibs\highgui\highgui.dsp".
Set dependencies:
Choose from menu: "Project" -> "Dependencies..."
For "cv" choose "cxcore",
For "cvaux" choose "cv", "cxcore",
for "highgui" choose "cxcore",
for your project choose all: "cxcore", "cv", "cvaux", "highgui".
After above tedious configuration, now you can finally enjoy the convenience of the OprnVC now. Just go to the C:\Program Files\OpenCV\samples\c to get some sample program.
If you don't know how to set up your sample program, here is my test using the sample program provided by OpenCV.
This program doing morphology algorithm: my test file
Here is the sample program's Screen Shot:
 
Hope this file can do help to you. If you get any problem during your settlement, just go to Google to get the answer, and if you deal the trouble you bumped, you might
mail to me how you solved your problem and I can add it in my page and share to others. Thanks you very much.
You can contact me through: keynes@cmlab.csie.ntu.edu.tw
Error Report
Q: I can't run the file in test.rar!
My Solution: Although I didn't have this kind of problem, but I solved this problem for my friend by adding the dll files in the Debug folder. You can find the dll you need in
C:\Program Files\OpenCV\bin or you might download the dll files from here : dll
Another Solution: You also can add the dll files in C:\Program Files\Microsoft Visual Studio\VC98\Bin
[Origional]http://graphics.csie.ntu.edu.tw/~keynes/OpenCV/
Another link is http://graphics.csie.ntu.edu.tw/~jean/graphix/tech/25/
A entry-level tutorial by Robert Laganièr
The latest (draft) version of documentation

3 comments:

Burt Ho said...

[BUG of OPENCV BETA5]lease refer to http://www.assuredigit.com/forum/display_topic_threads.asp?ForumID=11&TopicID=5308&PagePosition=1 and solution is
1. Find \\Program Files\OpenCV\cvaux\include\cvaux.h
2. Then Line 1137 origional is CvMemStorage* storage; /*storage for foreground_regions?/
Change to CvMemStorage* storage; /*storage for foreground_regions*/ then fine

Burt Ho said...

[LINK]Intel® Open Source Computer Vision Library documents (http://isa.umh.es/pfc/rmvision/opencvdocs/) including
1. Source code for stereo correspondence(http://isa.umh.es/pfc/rmvision/opencvdocs/ref/OpenCVRef_Experimental.htm#aux_stereo)2. 3D Object Tracker(http://isa.umh.es/pfc/rmvision/opencvdocs/ref/OpenCVRef_Experimental.htm#aux_3dTracking)

Anonymous said...

You could easily be making money online in the hush-hush world of [URL=http://www.www.blackhatmoneymaker.com]clickbank blackhat[/URL], It's not a big surprise if you have no clue about blackhat marketing. Blackhat marketing uses alternative or not-so-known methods to produce an income online.