MasteringOpenCV / code

Code for the book "Mastering OpenCV with Practical Computer Vision Projects" by Packt Publishing 2012.
Other
2.73k stars 1.65k forks source link

Chapter 3 Markerless AR with VS 2010 and OpenCV 2.4.6 on Win7 x64 #17

Closed mdeopujari closed 11 years ago

mdeopujari commented 11 years ago

Hi, I followed all steps in Readme to run this project. I even re-built OpenCV with OpenGL enabled. However, I get following error when i run the markerless_ar_demo.exe: markerless_ar_demo_error (the application was unable to start correctly (0xc000007b). Click OK to continue)

Also, I am unable to debug the app because I get the following error on pressing debug button: debug_error

Any clues? Thanks.

BloodAxe commented 11 years ago

You're trying to start "ALL_BUILD" target (see message box in second screenshot). Right click on "markerless_ar_demo" -> Set as startup program. Then run. This should help.

mdeopujari commented 11 years ago

Hi, I tried what you said above. However, the executable does not run or Debug (the application was unable to start correctly (0xc000007b)).

BloodAxe commented 11 years ago

Can you show output log, modules load log from the VS? This example has been written in Windows 7 64-bit, so i'm pretty sure i should work on your machine.

mdeopujari commented 11 years ago

So here is what I get when I try to Debug my application. I put a breakpoint on the first line of the main function in main.cpp: 'markerless_ar_demo.exe': Loaded 'C:\Users\mdeopujari\Documents\CSCI590\code-master\Chapter3_MarkerlessAR\build\src\Debug\markerless_ar_demo.exe', Symbols loaded. 'markerless_ar_demo.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file 'markerless_ar_demo.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file 'markerless_ar_demo.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file The program '[7788] markerless_ar_demo.exe: Native' has exited with code -1073741701 (0xc000007b).

mdeopujari commented 11 years ago

Thank you for your quick responses. Here is the Build output from VS:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------ 1>Build started 10/3/2013 2:25:15 PM. 1>InitializeBuildStatus: 1> Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild" because "AlwaysCreate" was specified. 1>FinalizeBuildStatus: 1> Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild". 1> Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.lastbuildstate". 1> 1>Build succeeded. 1> 1>Time Elapsed 00:00:01.14 2>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------ 2>Build started 10/3/2013 2:25:16 PM. 2>InitializeBuildStatus: 2> Creating "x64\Debug\ALL_BUILD\ALL_BUILD.unsuccessfulbuild" because "AlwaysCreate" was specified. 2>CustomBuild: 2> Build all projects 2>FinalizeBuildStatus: 2> Deleting file "x64\Debug\ALL_BUILD\ALL_BUILD.unsuccessfulbuild". 2> Touching "x64\Debug\ALL_BUILD\ALL_BUILD.lastbuildstate". 2> 2>Build succeeded. 2> 2>Time Elapsed 00:00:00.51 3>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------ 3>Project not selected to build for this solution configuration ========== Build: 2 succeeded, 0 failed, 1 up-to-date, 1 skipped ==========

BloodAxe commented 11 years ago

Can you try starting x86 binary instead of 64-bit build?

In theory, you're doing everything right, but actually 64-bits build has not been tested. In order to work correctly, OpenCV library should be also built for 64-bit (including every module and 3rd-party lib).

Pls, try with x86 architecture to see whether it will help.

mdeopujari commented 11 years ago

Hi, I tried building with x86 binary but changed OpenCV version to 2.4.4 ( I was having trouble compiling OpenCV2.4.6 in x86 mode). Now, I get a different error: image

The above mentioned .dll is present in the opencv build folder and I have explicitly tried to link it with the project(through project properties), yet it does not work. Any suggestions? I tried the same with debug mode and get similar .dll error.

BloodAxe commented 11 years ago

Hi. Good. It's very good sign. There are two ways to solve "missing dll problem" Either you copy all OpenCV dlls to the location of book's example executalble which is "C:\Users\mdeopujari\Documents\CSCI590\code-master\Chapter3_MarkerlessAR\build\src\Debug\" for Debug build. Or you add the location of OpenCV dlls to system or user PATH environment variable.

The systems PATH contains a list of folders where DLLs can be found. Add the OpenCV library path to this and the OS will know where to look if he ever needs the OpenCV binaries. Otherwise, you will need to copy the used DLLs right beside the applications executable file (exe) for the OS to find it, which is highly unpleasent if you work on many projects.

I hope this will solve your problem.

mdeopujari commented 11 years ago

Hey thanks for the solution. I got the 32-bit version working by placing the .dlls next to the .exe. So it looks like this code works with OpenCV versions before 2.4.6 on Windows 7 .

BloodAxe commented 11 years ago

You welcome! I'm glad your problem is solved now. Have a good time testing the example and extending it!