1.安装依赖
sudo apt install cmake
sudo apt install libgl1-mesa-dev
sudo apt install libglew-dev
sudo apt install libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols
sudo apt install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
sudo apt install pkg-config
sudo apt install libdc1394-22-dev libraw1394-dev
sudo apt install libjpeg-dev libpng-dev libtiff5-dev libopenexr-dev
2.安装pangolin
需要注意, 目前github上的pangolin为高版本,在ubuntu16.04下编译安装会报错!
所以,需要安装旧版本
git clone https://github.com/zzx2GH/Pangolin.git
之后进入Pangolin根目录,在Pangolin目录下创建build目录,进入build目录
在build目录下打开终端,
1.输入cmake ..
2.输入 make -j4编译, -j4是为了加速
3.输入sudo make install进行安装
至此,Pangolin安装完成
3.测试安装是否成功
进入build目录,进入example,进入HelloPangolin目录,打开终端,输入./ HelloPangolin执行可执行文件,看到如下界面说明成功
有可能报错:terminate called after throwing an instance of 'std::runtime_error'
what(): Pangolin X11: Unable to retrieve framebuffer options
回到Pangolin根目录,进入src,进入display,进入device,打开display_x11.cpp,找到这段代码:
staticint visual_attribs[] =
{
GLX_X_RENDERABLE , True,
GLX_DRAWABLE_TYPE , GLX_WINDOW_BIT,
GLX_RENDER_TYPE , GLX_RGBA_BIT,
GLX_X_VISUAL_TYPE , GLX_TRUE_COLOR,
GLX_RED_SIZE , 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_ALPHA_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_STENCIL_SIZE, 8,
GLX_DOUBLEBUFFER , glx_doublebuffer ? True : False,
GLX_SAMPLE_BUFFERS , glx_sample_buffers,
GLX_SAMPLES , glx_sample_buffers > 0 ? glx_samples : 0,
None
};
注释掉最后这两行:
//GLX_SAMPLE_BUFFERS , glx_sample_buffers,
//GLX_SAMPLES , glx_sample_buffers > 0 ? glx_samples : 0,
回到build目录,删除掉里面所有文件,重新进行一次cmake流程,重新执行HelloPangolin,即可成功