参考http://joshua-astray.blogbus.com/logs/204744800.html
SceneLib是AndrewDavison开发的基于c++的monoslam库,代码只支持1394摄像头,刚研究还不知道怎么改为usbcamera,且本次只是off-line模式的编译,以后在努力吧
(1)同学可以根据参考链接安装opengl,glut和pthread,命令如下
$ sudo apt-get install freeglut3freeglut3-dev libglut3 libglut3-dev libglew1.5 libglew1.5-devlibglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev $ sudo apt-get installlibpthread-stubs0 libpthread-stubs0-devmesa-common-dev
|
(2)接下来要安装1394摄像头所需要的库libdc1394命令如下
$sudo apt-get install libraw1394-11 libraw1394-dev libraw1394-doc |
(3)安装xformstoolkit这个貌似是vw安装要用,编译指导链接为http://xforms-toolkit.org/installation.html.
(4)SceneLib的downloadand install中下载
vw34.tar.gz scenelib.tar.gz glow_104.tar.gz monoslamglow.tar.gz testseqmonoslam.tar.gz
放至同一目录下,然后分别解压,命令如下:
$sudo tar xvfz vw34.tar.gz |
(5)首先安装glow
$cd glow_104 |
(6)vw的安装有很多错误,完整的安装命令如下
./bootstrap ./configure make makeinstall |
开始./configure的时候出现错误
checkingfor Qt... ./configure: line 7620: syntax error near unexpected token`fi'
解决办法是将7616的else注释掉即可。 接下来还有很多编译错误诸如
error:‘exit’ is not a member of ‘std’ error:‘free’ was not declared in this scope error:'memcpy' was not declared in this scope |
这类错误相应函数如free()或者memcpy()等未填加相应的头文件,百度他们所需的头文件添加进去就可以了,去掉exit()前面有std::的部分。
还有一些错误可以按照第一行给出的参考链接在./configure之前进行修改,如下:
修改VW34/VW/GeomObjects/point3d.h 在end namespace Vw前添加两行 }; Point3D operator+(const Point3D &p1, const Point3D &p2); Point3D operator/(const Point3D &p1, const double a); typedef Point3D Vector3D; }; // end namespace VW
修改VW34/VW/GeomObjects/point2d.h
在endnamespace VW前添加两行
}; Point2D operator+(const Point2D &p1, const Point2D &p2); Point2D operator/(const Point2D &p1, const double a); typedef Point2D Vector2D; }; // end namespace VW
修改‘VW34/VW/GeomObjects/lineseg2d.h’
在endnamespace VW前添加两行
}; std::ostream& operator<<(std::ostream& s, const LineSeg2D &ls); std::istream& operator>>(std::istream& s, LineSeg2D &ls); }; // end namespace VW
修改‘VW34/VW/GeomObjects/lineseg3d.h’
在endnamespace VW前添加代码如下
}; double Norm2(const LineSeg3D &ls); double Norm(const LineSeg3D &ls); std::ostream& operator<<(std::ostream& s, const LineSeg3D &ls); std::istream& operator>>(std::istream& s, LineSeg3D &ls); // Other funcs VW::LineSeg3D operator+(const VW::LineSeg3D &line, const VW::Point3D &point); VW::LineSeg3D operator-(const VW::LineSeg3D &line, const VW::Point3D &point); }; // end namespace VW Modify ‘VW34/VW/Improc/matchdata.h’ file 添加72,73两行代码 std::ostream & operator << (std::ostream & s, const MatchData & m); std::istream & operator >> (std::istream & s, MatchData & m); /** Sort into order of increasing match score. */ void SortAscending(std::vector& list); /** Sort into order of decreasing match score. */ void SortDescending(std::vector& list);
修改 ‘VW34/VW/Sequencers/sequencerbase.h’
修改127行代码如下
void CopyImage(ImType& image, unsigned int which_channel=0) { }; (若不修改错误为error:templates may not be‘virtual’
) (7)编译SceneLib
$cd SceneLib |
这里运行./configure有可能提示找不到libXext,在configure文件里libXext的dir里添加/usr/lib/i386-linux-gnu
(8)编译MONOslamglow 修改Makefile文件
VWLIBS中删除-lVWFirewire
VWLIBS= -L$(VWDIR)/lib -lVWGLOW -lVWGL -lVW -lVNL
CFLAGS 删除-D$(OS)-D$(ARCH)
CFLAGS = $(GLOWHEADERS) $(VWHEADERS) $(SCENEHEADERS) -Wall -D_REENTRANT -O3 -g #-D_REALTIME_
LINKFLAGS中删除$(FIREWIRELIBS).
LINKFLAGS = $(SCENELIBS) $(VWLIBS) $(GLOWLIBS) $(GLLIBS) -Wall -O2 $(PTHREADLIBS) $(MATHSLIB 改正以后直接sudo make即可完成。 (9)运行monoslam ./monoslam