PTAM compile and run in windows X64 visual studio 2012 with opencv camera

折腾了两天PTAM,终于跑起来了。记录如下,希望可以帮到有需要的朋友。

 

Environment: windows 7 x64 visual studio 2012

 

1.PTAM

 
guys might help
http://happymeme.com/?p=46
http://caocancabbage.blogspot.com/2012/09/parallel-tracking-and-mapping-ptam-in.html
https://ewokrampage.wordpress.com/troubleshooting-faq/
 
2.compile PTAM
1. first try with https://github.com/hustcalm/PTAM-opencv since I don't have a 1394 camera and using webcam. Thanks to them, they have writed things work with opencv camera.
2. things you will need.
 
these are things needed to compile LibCVD, TooN, and GVars3(they are already in the PTAM-opencv project) , download X64 version if there exist.
 
3. trying to compile libcvd
change the properties adding the header files libs path and and debug is OK!!!
release
 1> Performing Custom Build Tools
1> 系统找不到指定的文件。
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(172,5): error MSB6006: "cmd.exe" exited with code 1. 
 
错误指向 
Performing Custom Build Tools
1>  已复制         1 个文件。
custom build的问题,打开.vcxproj,搜
custom build,可以看到这个build在干什么,仔细对比,发现debug和release的不同。
 
check this carefully!
    <CustomBuild Include="config.h">
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy ..\vc2005\%(Filename)%(Extension) ..\..\cvd\
</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy ..\vc2005\%(Filename)%(Extension) ..\..\cvd\
</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy ..\vc2005\%(Filename)%(Extension) ..\..\cvd\
</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(Filename)%(Extension) ..\..\cvd\
</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\cvd\%(Filename)%(Extension);%(Outputs)</Outputs>
    </CustomBuild>
全部改一样,build success!!!!
 
4. trying to compile gvar3
path to prebuild.2
path to fltk2.0 (download it from web)
do it for both of the project.
 
build success!!!
 
5. trying to build PTAM
calibration
path to include files.
change to opencv camera rather than 1394, change to the file VideoSource_Linux_OpenCV.cc
adding the right .cc files, why this happenning...
link error... probably beacause of the opencv cv and other things in X86/X64
make sure all things are x64 version. X86 have pthreadVC2, VCE2, VSE2 x64 only have VC2. hopefully...
build success!!!
run missing dll. 
add dlls like:

Search MSDN for "How to: Set Environment Variables for Projects". (It's Project>Properties>Configuration Properties>Debugging "Environment" and "Merge Environment" properties for those who are in a rush.)

The syntax is NAME=VALUE and macros can be used (for example, $(OutDir)).

For example, to prepend C:\Windows\Temp to the PATH:

PATH=C:\WINDOWS\Temp;%PATH%

Similarly, to append $(TargetDir)\DLLS to the PATH:

PATH=%PATH%;$(TargetDir)\DLLS

missing ....      libifcoremdd.dll
this is fortran things....
 
missing...          MSVCR120D.dll
 
Ultimate solutions here!!!
 
these is all because of  LAPACK & BLAS...     
 
 For this purpose we patched the LAPACK-3.5.0 source codes, compiled them using Intel ® Fortran compiler 2013 and linked with Miscrosoft Visual Studio 12: 
 
try to find dll lib dependency with depency walker
 

 
fllow these guys, and use the MT version of libs and compile
 
 
unresolved external symbol dgesvd_  
 
THIS IS ALL BECAUSE OF WRONG LIB AND DLL OF Lapack !!! REMEMBER! the lapack lib and dll should be exactly the same of the PTAM project setting, X64, compiler, MT
 
try to download the source here http://icl.cs.utk.edu/lapack-for-windows/lapack/#lapacke and compile them!
work!!!
 
make sure that all of the libs/dll are compiled/downloaded in exactly the same way!!  X64 debug/release MT/MTD!!
 
6.compile PTAM
.h and .cc files are missing, add them all.
change camera things to opencvs 
solve stranage .h files included. comment out#include <unistd.h>
 
done! running!
 
 
3. calibration and run
http://wiki.ros.org/ethzasl_ptam/Tutorials/camera_calibration 
run calibration first,
copy the setting.cfg to project path where camera.cfg saved by the calibration.


ENJOY!
 
posted @ 2015-06-05 15:37  flankechen  阅读(1551)  评论(0编辑  收藏  举报