Beruflich Dokumente
Kultur Dokumente
X Cha
with OpenCV 2.3 in Microsoft Visual Studio 2010 in Win... http://siddhantahuja.wordpress.com/2011/07/18/getting-started-with-open...
X Cha
F- ng F- ng
PD e PD e
!
W
W
O
O
N
N
y
y
bu
bu
to
to
k
k
lic
lic
siddhant ahuja (sid)
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
Home
Education
Graphics Design
Experience
Publications
Getting Started with OpenCV 2.3 in Microsoft Visual Studio 2010 in Windows 7 64-bit
18 07 2011
13 Votes
I was trying to install OpenCV 2.3 on my Windows 7 64-bit machine and i kept getting the error: The application was unable to start correctly (0xc000007b)
I tried chasing the problem down using freely available program Dependency Walker and it looked like my executable project was x86 whereas all the dll files it was loading up were x64.
So after many tries including re-building OpenCV using CMake, changing dll links to x86, etc., i finally figured out how to solve this problem, which i have presented as a tutorial below.
This tutorial assumes that you have installed Microsoft Visual Studio 2010 Professional. If you are a student you can get it for free at https://www.dreamspark.com/Products
/Product.aspx?ProductId=25.
OpenCV is a computer vision library written mainly in C that focuses on real time video processing. It is open source or free to the public.
1. Go to http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3/
2. Select the OpenCV-2.3.0-win-superpack.exe file and download it.
3. Go the folder where you downloaded the executable file in Step 2 and select “Run as Administrator”.
4. The executable file is essentially an archive of files with an extractor built in. It will ask you to select the location where you would like it to extract all its contents. Select:
C:\Program Files\ as the path and click Extract. It will create a folder called OpenCV2.3 with the path: C:\Program Files\OpenCV2.3
1. To access the system path in Vista go to Control Panel\System and Security\System and on the left hand side select Advanced system settings this should bring up the Systems
Properties dialogue. Click on the Advanced tab and then the Environment Variables button.
2. This will bring up the Environment Variables dialogue. In the System Variables box select Path and then Edit
3. When modifying the path know that it is sensitive to all characters including spaces. To add the new bin, type a semicolon directly after the text that is there without adding in a
!
W
W
O
O
N
N
y
y
bu
bu
space. Next add the path to the bin file. The path is the same as where you chose to install OpenCV back in step 4 of Downloading and Installing OpenCV section plus \bin. For
to
to
k
k
example if you chose to install OpenCV in:
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k C:\Program Files\OpenCV2.3 c u -tr a c k
Make sure to restart your computer so the changes can take effect.
Creating a Project
2. In the left box click on Configuration Properties and on the top right click on Configuration Manager
3. In the Configuration Manager dialog box that opens up, under Active Solution Platform combo box select New.
4. In the New Solution Platform dialog box that opens up, under Type or select the new platform, select x64, copy settings from Win32 and make sure that Create new project
platforms is selected. Click OK.
5. You will notice that the in the Configuration Manager dialog box x64 platform has now been selected. Click Close.
!
W
W
O
O
N
N
y
y
bu
bu
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
IMPORTANT note that all these paths assume that you installed in the default location, if you installed in a different location; for example Program Files (x86) instead of Program
Files, make sure you change these paths to reflect that.
IMPORTANT note that all these paths assume that you installed in the default location, if you installed in a different location; for example Program Files (x86) instead of Program
Files, make sure you change these paths to reflect that.
Sample Program
This program will capture video from a camera and display it. Press escape to stop capturing and displaying frames.
It may be necessary to change the number in this line of code to select the camera source:
1 CvCapture* capture = cvCaptureFromCAM(1); // capture from video device #1
If you do not know the video device number just try 0, then 1, 2 or else -1. Copy and paste the following code:
01 #include "stdafx.h"
02 #include <highgui.h>
03
04 int _tmain(int argc, _TCHAR* argv[])
05 {
06 int c;
07 // allocate memory for an image
08 IplImage *img;
09 // capture from video device #1
10 CvCapture* capture = cvCaptureFromCAM(1);
11 // create a window to display the images
12 cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
13 // position the window
14 cvMoveWindow("mainWin", 5, 5);
15 while(1)
16 {
17 // retrieve the captured frame
18 img=cvQueryFrame(capture);
19 // show the image in the window
20 cvShowImage("mainWin", img );
21 // wait 10 ms for a key to be pressed
22 c=cvWaitKey(10);
23 // escape key terminates program
24 if(c == 27)
25 break;
26 }
27 return 0;
28 }
!
W
W
O
O
N
N
y
y
bu
bu
to
to
k
k
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
« Student-built vehicle finds its own way Working with ROS and OpenCV »
Actions
Comments RSS
Trackback
Information
48 responses
20 07 2011
Reply
5 08 2011
What version of Visual Studio are you running? The instructions are meant for Visual Studio 2010 on Windows 7 x64 platform only. If you still keep getting that error try the
following:
- http://stackoverflow.com/questions/3926866/lnk1104-cannot-open-file-kernel32-lib
- http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/2da4c574-d53d-41d0-b579-c2754463c471
- http://blogs.msdn.com/b/saurabh_singh/archive/2009/01/30/getting-fatal-error-lnk1181-cannot-open-input-file-kernel32-lib.aspx
cheers
sid
Reply
21 07 2011
Roman (08:58:42) :
1 0 Rate This
Reply
!
W
W
O
O
N
N
y
y
bu
bu
23 07 2011
to
to
k
k
lic
lic
C
C
w
w
m
m
w Robert (15:00:54) : w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
1 0 Rate This
I’ve tried lots of methods posted on the net and your post was the only information on the net that helped. Thank You so much!
Reply
25 07 2011
cataplus (16:45:42) :
0 0 Rate This
Thanks a lot ! I spent a lot of time to make it work on dev c++ ! I chose as well “Without using precompiled header” in the “precompiled header section”. It avoid me a compilation
error.
Tahnks
Reply
26 07 2011
Steve (05:36:32) :
0 0 Rate This
Reply
28 07 2011
gobarganesh (17:31:38) :
0 0 Rate This
Thanks Yaar…
Just because of this post, I am feeling relaxed now.
I was stuck on this OpenCV configuration for around 4-5 hours. Eventually, I came across your post…
Reply
30 07 2011
Charlotte (10:49:59) :
0 0 Rate This
Reply
31 07 2011
nk (13:08:08) :
0 0 Rate This
Thanks a lot
Reply
5 08 2011
Bandar (03:24:01) :
0 0 Rate This
I have a problem with step 5. I did everything properly but when I added x64, nothing is added and still wind32 only. I have followed the steps carefully. Please guide me what
should I do.
Sincerely
Bandar
Reply
5 08 2011
Hi
Are you sure you are on a 64-bit machine? The option for x64 should already exist. Once you select it, check in the configuration manager if it has been selected or not. Refer to:
http://msdn.microsoft.com/en-us/library/9yb4317s(v=vs.80).aspx for more info
cheers
Reply
5 08 2011
lorch@kit.edu (09:00:41) :
0 0 Rate This
It works! Thanks!!
!
W
W
O
O
N
N
y
y
bu
bu
Reply
to
to
k
k
8 08 2011
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k Bandar (02:05:44) : c u -tr a c k
0 0 Rate This
Hello sir,
In step 4, I want to select x64, as you mentioned, but there is nothing to select. It is just emply list. I typed x64 because no chioce but also nothing created. So, what should I do
now?
King regards
Bandar
Reply
8 08 2011
maxzoel (04:23:07) :
0 0 Rate This
oh my god!
you saved me a lot.
Reply
8 08 2011
Bandar (05:48:18) :
0 0 Rate This
Reply
9 08 2011
There is no way for me to troubleshoot this. The option for x64 was there by default for me. If other people encounter similar issues, maybe they can point you to a solution. I will
keep this in mind if i think of something.
Reply
9 08 2011
manmalik (10:54:27) :
0 0 Rate This
Manish
Reply
12 08 2011
Bandar (02:56:36) :
0 0 Rate This
Reply
19 08 2011
DW (20:19:52) :
0 0 Rate This
Hi,
I was having the same problem you described, and now I found out what is wrong. You said you were using Visual Studio C++ 2010 Express Edition. I believe the problem is in you
version of VS. I was using the Express, but then I uninstalled it and installed the Professional Edition. By doing this, the problem was solved! Now, the x64 option is there when I
follow the steps. Also, the example code worked properly. So, I recommend you to install VS 2010 Professional; if that’s not possible, try using the CMake program to load the
OpenCV libraries for your project. Hope this may help you.
Best regards!
Reply
13 08 2011
!
W
W
O
O
N
N
y
y
bu
bu
0 0 Rate This
to
to
k
k
lic
lic
C
C
w
w
m
m
w It works! Thanks!! w
w
w
o
o
.d o .c .d o .c
c u -tr a c k c u -tr a c k
Reply
16 08 2011
arron (18:04:54) :
0 0 Rate This
Hello,
I encountered the same problem as Bandar’s. There is nothing to select at Step.4. I am running windows 7 64 bit on BootCamp on my Macbook. But I don’t think it is the reason.
Now, I am clueless…
Any suggestions?
Reply
19 08 2011
DW (21:06:04) :
0 0 Rate This
Hi,
Try doing what I suggested to Bandar. I think it will solve your problem.
Best regards!
Reply
26 08 2011
Arron (07:34:05) :
0 0 Rate This
25 08 2011
Bandar (08:27:31) :
1 0 Rate This
Hello DW,
You’re awesome. Now, it works. I did what you told me to do and now everything is fine. Again thank you so much. You really did help me.
Sincerely
Bandar
Reply
26 08 2011
Bandar (04:48:15) :
1 0 Rate This
Reply
3 09 2011
dinofizz (14:19:17) :
0 0 Rate This
You can still use VC++ 2010 Express and build 64-bit applications, but you must also install the “Microsoft Windows SDK for Windows 7 and .NET Framework 4 .
And another link for the SDK ISO (remember to choose the version for 64-bit machines “GRMSDKX_EN_DVD.iso”:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8442
Dino
Reply
13 09 2011
Nagesh (12:02:00) :
0 0 Rate This
Hi, I went through all the steps you mentioned, but still I am getting errors “UNRESOLVED SYMBOLS”.
First, I tried to run OpenCV2.1, it didn’t work
Then, I tried to install OpenCV2.3.1, it didn’t work
I tried OpenCV2.3, it’s not working
!
W
W
O
O
N
N
y
y
bu
bu
I am doing all this stuff on the same VS2010. Do you think uninstalling and installing the VS2010 again will make any difference, b’coz I can’t do that.
to
to
k
k
PLEASE HELP
lic
lic
C
C
w
w
m
m
w w
w
w
o
o
.d o .c .d o .c
c u -tr a c k Reply c u -tr a c k
15 09 2011
Reply
14 09 2011
Valentin (11:28:10) :
0 0 Rate This
I made everything step by step. Bu in the end I get a grey skin (instead of a video). I am using windows 7 x86 (but I changed every x64 in the directories with x86. Still nothing….
Reply
15 09 2011
Hmm, gray window is just a OpenCV HighGUI Window with no content present. Can you check if an image was successfully captured from the webcam? Does the webcam light
turn on while capture? Can you pause the code and look at the image structure to confirm data is there?
I don’t have n x86 machine with me to test this out. Maybe someone else here might be able to provide some assistance?
cheers
sid
Reply
14 09 2011
Valentin (11:32:15) :
0 0 Rate This
Reply
15 09 2011
The main thing for x86 is to ignore steps 2-5 under Configuring Visual Studio.
Also in step 9 replace x64 with x86 for *.dll file locations.
Rest all should be same. I don’t have a x86 machine to test presently..I have a strong feeling it should work without a problem though.
cheers
sid
Reply
19 09 2011
m7ammad7assan (09:41:59) :
0 0 Rate This
Reply
19 09 2011
Reply
19 09 2011
m7ammad7assan (12:36:03) :
0 0 Rate This
thank you very very much i did it … i saw me wonderful face … hahahaha
Reply
20 09 2011
Soumak (21:49:08) :
0 0 Rate This
it works! Thanks much. It is a great tutorial. I am looking for one more tweaks. Is there any way to permanently add the include directory and linker directories to project settings? I
!
W
W
O
O
N
N
y
y
bu
bu
mean, can we add this to a global project settings or something? Otherwise, it is a pain to follow the same configuration steps every time we create a new project.
to
to
k
k
lic
lic
C
C
w
w
m
m
w Reply w
w
w
o
o
c .c
.d o k. .d o
c u -tr a c k
r a c09 2011
c u - t27
ali (17:01:29) :
0 0 Rate This
Hello
Thank You, Thank You, Thank You, Thank You,
A few weeks really had a problem with this tutorial, you saved me
I am the Persian language. Google Translator to translate all your web page and this message has
Thanks, Google Translator
Reply
1 10 2011
Jose (03:50:18) :
1 0 Rate This
Thank’s Sid.
Reply
6 10 2011
msk (09:25:56) :
0 0 Rate This
Reply
10 10 2011
Tony (06:34:13) :
0 0 Rate This
What if i only have Microsoft Visual Studio 2010 Express? Is that OK?
Reply
10 10 2011
Hey..you could still use the express edition, but some people have had issues with it. A solution was posted by one of the members in the comments section for your product
version. Look at: http://siddhantahuja.wordpress.com/2011/07/18/getting-started-with-opencv-2-3-in-microsoft-visual-studio-2010-in-windows-7-64-bit/#comment-411
cheers
Reply
14 10 2011
Arun (21:09:14) :
0 0 Rate This
Reply
17 10 2011
Hi
If you follow line by line, word by word every step, you should not get an error. However, i can try and troubleshoot the problem that you are experiencing:
1. Please make sure that all the include directories in step 6 and 7 of “Configuring Visual Studio” section, resolve to “actual” directories. You may have OpenCV installed in
“Program Files (x86)” folder or directly in “C:\OpenCV\”.
2. If you still get this error, please make sure you have followed “Manually Changing the System Path to Include the Bin File” section. Again, you may have OpenCV installed in
“Program Files (x86)” folder or directly in “C:\OpenCV\”.
3. Make sure you installed the right version of OpenCV
5. Make sure you are using it in Visual Studio 2010 Professional addition for 64 bit operating systems.
If you are still experiencing a problem, please put your project into an archive and send it to me, so that i can examine it.
regards
sid
Reply
17 10 2011
OpenCV Set Up « CS * (01:23:30) :
0 0 Rate This
!
W
W
O
O
N
N
y
y
bu
bu
[...] The step by step process is listed in the following link: http://siddhantahuja.wordpress.com/2011/07/18/getting-started-with-opencv-2-3-in-microsoft-visual-st… [...]
to
to
k
k
lic
lic
C
C
w
w
m
m
w Reply w
w
w
o
o
c .c
.d o k. .d o
c u -tr a c k
r a c10 2011
c u - t21
Reply
31 10 2011
Reply
17 11 2011
eduardo (03:21:27) :
0 0 Rate This
Reply
10 11 2011
john (09:52:52) :
0 0 Rate This
thanks lot.
Reply
Leave a Reply
Categories
Autonomous Racing Challenge 2008 (12)
Autonomous Racing Challenge 2009 (10)
C plus plus (3)
C# (2)
CAD Drawings (1)
Computer Vision (20)
Dataset (1)
IGVC 2011 (4)
libcurl (1)
MATLAB (16)
Media Coverage (19)
Networking (2)
News (2)
PHP (1)
Press Release (6)
Proofs (1)
Random Code (26)
Research (6)
Robot Racing 2010 (1)
Robot Racing 2011 (2)
!
W
W
O
O
N
N
y
y
bu
bu
Robotics (3)
to
to
k
k
ROS (4)
lic
lic
C
C
w
w
m
m
w . c Slideshows (4) w
w
w
o
o
.d o k .d o .c
c u -tr a c c u -tr a c k
Stereo-Vision (13)
Technical Reports (6)
Uncategorized (3)
Videos (8)
Recent Posts
ROS + OpenCV : Read a Video File using FFMPEG
ROS Packages for Color Thresholding an Image
ROS and FFMPEG talking to each other
Waterloo robot tears up the track
Robot Racing 2011 Videos
Archives
August 2011 (3)
July 2011 (4)
June 2011 (1)
March 2011 (1)
February 2011 (1)
January 2011 (1)
June 2010 (1)
May 2010 (3)
April 2010 (2)
March 2010 (3)
February 2010 (8)
January 2010 (2)
December 2009 (2)
November 2009 (2)
September 2009 (1)
August 2009 (4)
July 2009 (6)
June 2009 (5)
May 2009 (9)
April 2009 (7)
July 2008 (1)
May 2008 (9)
April 2008 (1)
April 2007 (1)
Pages
Education
Course-Topics in Distributed Vision Networks
Experience
Graphics Design
Publications
2008 Publications
2009 Publications
Tags
algorithm Area based Autonomous Racing Challenge 2008 Autonomous Racing Challenge 2009 C# Computer Vision Correlation Cost Functions CVSS Lab Daily News DSCP
half-occluded Histogram IGVC Image Processing Low-texture MATLAB code Michael Stolarchuk Microsoft Visual Studio 2008 NCC non-parametric local transform Normalized Cross Correlation OpenCV PEO
Robot Racing 2010 ROS
Professional Engineers of OntarioSiddhant Ahuja Similarity measures
SAD SHD SSD Stereo-matching Stereo-Vision Sum of Squared Differences Team Awesome Team Flash
Team Invincible Thanh Nguyen ToS University of Windsor video Windows Vista Windsor-Essex Chapter Windsor Star
Meta
Register
Log in
Entries RSS
Comments RSS
WordPress.com