针孔相机模型
畸变
双目相机模型
RGB-D相机模型
OPENCV
待完成
sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
sudo apt-get update
sudo apt-get install libpcl-all
asber@asber-X550VX:~$ sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
[sudo] asber 的密码:
This only exists for history reasons. Please use the PCL version included in Ubuntu:
sudo apt install libpcl-dev
---
The Point Cloud Library (or PCL) is a large scale, open project for point cloud processing.
The PCL framework contains numerous state-of-the art algorithms including filtering, feature estimation, surface reconstruction, registration, model fitting and segmentation.
PCL is released under the terms of the BSD license and is open source software. It is free for commercial and research use. We are financially supported by Willow Garage, NVidia, and Google.
更多信息: https://launchpad.net/~v-launchpad-jochen-sprickerhof-de/+archive/ubuntu/pcl
按 [ENTER] 继续或 Ctrl-c 取消安装。
获取:1 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 InRelease
忽略:1 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 InRelease
获取:2 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 Release [574 B]
获取:2 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 Release [574 B]
命中:3 http://mirrors.aliyun.com/ubuntu xenial InRelease
获取:4 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease [109 kB]
命中:5 http://mirrors.ustc.edu.cn/ros/ubuntu bionic InRelease
获取:7 http://mirrors.aliyun.com/ubuntu xenial-security InRelease [109 kB]
忽略:8 http://dl.google.com/linux/chrome/deb stable InRelease
获取:9 http://dl.google.com/linux/chrome/deb stable Release [943 B]
命中:10 http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic InRelease
获取:11 http://dl.google.com/linux/chrome/deb stable Release.gpg [819 B]
获取:12 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 Packages [1,033 kB]
命中:13 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
获取:14 http://mirrors.aliyun.com/ubuntu xenial-updates/main i386 Packages [860 kB]
获取:15 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
获取:16 http://packages.ros.org/ros/ubuntu xenial InRelease [4,678 B]
获取:17 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,104 B]
获取:18 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [323 kB]
命中:19 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
获取:20 http://mirrors.aliyun.com/ubuntu xenial-updates/main DEP-11 48x48 Icons [14.6 kB]
获取:21 http://mirrors.aliyun.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [241 kB]
获取:22 http://mirrors.aliyun.com/ubuntu xenial-updates/universe i386 Packages [695 kB]
获取:23 http://packages.ros.org/ros-shadow-fixed/ubuntu xenial InRelease [4,678 B]
获取:24 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 Packages [764 kB]
获取:25 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
获取:26 http://packages.ros.org/ros/ubuntu xenial/main amd64 Packages [808 kB]
获取:27 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [274 kB]
获取:28 http://mirrors.aliyun.com/ubuntu xenial-updates/universe DEP-11 48x48 Icons [29.4 kB]
获取:29 http://mirrors.aliyun.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [406 kB]
获取:30 http://mirrors.aliyun.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [76.2 kB]
获取:31 http://mirrors.aliyun.com/ubuntu xenial-security/main DEP-11 48x48 Icons [14.6 kB]
获取:32 http://mirrors.aliyun.com/ubuntu xenial-security/main DEP-11 64x64 Icons [84.0 kB]
获取:33 http://mirrors.aliyun.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [124 kB]
命中:34 http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu bionic InRelease
获取:35 http://mirrors.aliyun.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [194 kB]
忽略:36 http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu bionic InRelease
获取:37 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
获取:38 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.0 kB]
错误:39 http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
获取:40 http://packages.ros.org/ros/ubuntu xenial/main i386 Packages [579 kB]
获取:41 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [979 kB]
获取:42 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]
获取:43 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [116 kB]
获取:44 http://packages.ros.org/ros-shadow-fixed/ubuntu xenial/main i386 Packages [579 kB]
获取:45 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,006 kB]
获取:46 http://packages.ros.org/ros-shadow-fixed/ubuntu xenial/main amd64 Packages [808 kB]
获取:47 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
获取:48 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [26.4 kB]
获取:49 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [254 kB]
获取:50 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [37.8 kB]
获取:51 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [205 kB]
获取:52 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [448 kB]
获取:53 http://cn.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,464 B]
获取:54 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [739 kB]
获取:55 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [585 kB]
获取:56 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [285 kB]
获取:57 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [70.9 kB]
获取:58 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [140 kB]
获取:59 http://cn.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [7,920 B]
正在读取软件包列表... 完成
E: 仓库 “http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu bionic Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
asber@asber-X550VX:~$ sudo apt-get update
获取:1 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 InRelease
忽略:1 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 InRelease
获取:2 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 Release [574 B]
获取:2 file:/var/cuda-repo-10-1-local-10.1.243-418.87.00 Release [574 B]
命中:3 http://mirrors.aliyun.com/ubuntu xenial InRelease
命中:4 http://mirrors.ustc.edu.cn/ros/ubuntu bionic InRelease
命中:5 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease
忽略:6 http://dl.google.com/linux/chrome/deb stable InRelease
命中:7 http://mirrors.aliyun.com/ubuntu xenial-security InRelease
命中:9 http://dl.google.com/linux/chrome/deb stable Release
命中:10 http://packages.ros.org/ros/ubuntu xenial InRelease
命中:11 http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic InRelease
命中:12 http://packages.ros.org/ros-shadow-fixed/ubuntu xenial InRelease
命中:13 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
命中:15 http://security.ubuntu.com/ubuntu bionic-security InRelease
命中:16 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
命中:17 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
命中:18 http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu bionic InRelease
命中:19 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
忽略:20 http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu bionic InRelease
错误:21 http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
正在读取软件包列表... 完成
E: 仓库 “http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu bionic Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
asber@asber-X550VX:~$ sudo apt-get install libpcl-all
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 无法定位软件包 libpcl-all
Ubuntu18.04下安装PCL1.9.1
make遇到问题ib-lib64-libsm-so-undefined-reference-to-uuid-unparse-l
安装好了
这里建议下载slam的代码 因为我们没有那个文件pose.txt,之前一直git clone不了,然后认为是国内速度慢,自己5$去vultr上买了服务器搭了梯梯子,结果发现还是一样慢(德国服务器),再去github看,提供的百度网盘地址可以用,于是用百度网盘下载了
#include
#include
using namespace std;
#include
#include
#include
#include // for formating strings
#include
#include
#include
int main( int argc, char** argv )
{
vector colorImgs, depthImgs; // 彩色图和深度图
vector poses; // 相机位姿
ifstream fin("./pose.txt");
if (!fin)
{
cerr<<"请在有 pose.txt 的目录下运行此程序"<>d;
Eigen::Quaterniond q( data[6], data[3], data[4], data[5] );
Eigen::Isometry3d T(q);
T.pretranslate( Eigen::Vector3d( data[0], data[1], data[2] ));
poses.push_back( T );
}
// 计算点云并拼接
// 相机内参
double cx = 325.5;
double cy = 253.5;
double fx = 518.0;
double fy = 519.0;
double depthScale = 1000.0;
cout<<"正在将图像转换为点云..."< PointCloud;
// 新建一个点云
PointCloud::Ptr pointCloud( new PointCloud );
for ( int i=0; i<5; i++ )
{
cout<<"转换图像中: "< ( v )[u]; // 深度值
if ( d==0 ) continue; // 为 0 表示没有测量到
Eigen::Vector3d point;
point[2] = double(d)/depthScale;
point[0] = (u-cx)*point[2]/fx;
point[1] = (v-cy)*point[2]/fy;
Eigen::Vector3d pointWorld = T*point;
PointT p ;
p.x = pointWorld[0];
p.y = pointWorld[1];
p.z = pointWorld[2];
p.b = color.data[ v*color.step+u*color.channels() ];
p.g = color.data[ v*color.step+u*color.channels()+1 ];
p.r = color.data[ v*color.step+u*color.channels()+2 ];
pointCloud->points.push_back( p );
}
}
pointCloud->is_dense = false;
cout<<"点云共有"<size()<<"个点."<
PS:请将joinMap文件放到带有pose.txt
asber@asber-X550VX:~/slambook-master/slambook/ch5/joinMap/build$ ./joinMap
请在有pose.txt的目录下运行此程序
asber@asber-X550VX:~/slambook-master/slambook/ch5/joinMap/build$ sudo mv joinMap ..
[sudo] asber 的密码:
asber@asber-X550VX:~/slambook-master/slambook/ch5/joinMap/build$ ls
CMakeCache.txt CMakeFiles cmake_install.cmake Makefile
asber@asber-X550VX:~/slambook-master/slambook/ch5/joinMap/build$ cd ..
asber@asber-X550VX:~/slambook-master/slambook/ch5/joinMap$ ls
build color joinMap joinMap.kdev4
CMakeLists.txt depth joinMap.cpp pose.txt
asber@asber-X550VX:~/slambook-master/slambook/ch5/joinMap$ ./joinMap
正在将图像转换为点云...
转换图像中: 1
转换图像中: 2
转换图像中: 3
转换图像中: 4
转换图像中: 5
点云共有1081843个点.