python 画3维轨迹图并进行比较的实例


Posted in Python onDecember 06, 2019

一. 数据的格式

首先我们需要x,y,z三个数据进行画图。从本实验用到的数据集KITTI 00.txt中举例:

1.000000e+00 9.043680e-12 2.326809e-11 5.551115e-17 9.043683e-12 1.000000e+00 2.392370e-10 3.330669e-16 2.326810e-11 2.392370e-10 9.999999e-01 -4.440892e-16

一组有12个数据,相当于T={R,t},R是3×3的矩阵,t是3×1的矩阵。我们需要的是t的数据。

有些groundtruth是8个数据,第一个是时间戳,在三个是x,y,z,后面四个是是四元数的数据。

代码如下:

# import necessary module
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np

# load data from file
# you can replace this using with open
data1 = np.loadtxt("./dataset/poses/00.txt")

first_2000 = data1[:, 3]
second_2000 = data1[:, 7]
third_2000 = data1[:, 11]
data2 = np.loadtxt("../temp/kittiseq00_imu.txt")
first_1000 = data2[:, 1]
second_1000 = data2[:, 2]
third_1000 = data2[:, 3]
# print to check data
#print first_2000
#print second_2000
#print third_2000

# new a figure and set it into 3d
fig = plt.figure()
ax = fig.gca(projection='3d')

# set figure information
ax.set_title("3D_Curve")
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_zlabel("z")

# draw the figure, the color is r = read
figure1 = ax.plot(first_2000, second_2000, third_2000, c='r')
figure2 = ax.plot(first_1000, second_1000, third_1000, c='b')
plt.show()

效果图(电脑比较垃圾,后面的轨迹跟踪的时候提取的特征点太少):

python 画3维轨迹图并进行比较的实例

以上这篇python 画3维轨迹图并进行比较的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。

Python 相关文章推荐
Python实现的百度站长自动URL提交小工具
Jun 27 Python
python中字符串前面加r的作用
Jun 04 Python
Python上传package到Pypi(代码简单)
Feb 06 Python
详解python的几种标准输出重定向方式
Aug 15 Python
SVM基本概念及Python实现代码
Dec 27 Python
Python3.6简单反射操作示例
Jun 14 Python
对python读取CT医学图像的实例详解
Jan 24 Python
python try except返回异常的信息字符串代码实例
Aug 15 Python
Python多线程模块Threading用法示例小结
Nov 09 Python
Python处理mysql特殊字符的问题
Mar 02 Python
Python视频编辑库MoviePy的使用
Apr 01 Python
python继承threading.Thread实现有返回值的子类实例
May 02 Python
解决pyshp UnicodeDecodeError的问题
Dec 06 #Python
python创建ArcGIS shape文件的实现
Dec 06 #Python
使用pyshp包进行shapefile文件修改的例子
Dec 06 #Python
利用pyshp包给shapefile文件添加字段的实例
Dec 06 #Python
详解Python在使用JSON时需要注意的编码问题
Dec 06 #Python
用python求一重积分和二重积分的例子
Dec 06 #Python
解决Numpy中sum函数求和结果维度的问题
Dec 06 #Python
You might like
php curl_init函数用法
2014/01/31 PHP
利用Homestead快速运行一个Laravel项目的方法详解
2017/11/14 PHP
PHP获取MySQL执行sql语句的查询时间方法
2018/08/21 PHP
laravel ORM关联关系中的 with和whereHas用法
2019/10/16 PHP
js实现目录定位正文示例
2013/11/14 Javascript
JS实现上传图片实时预览功能
2017/05/22 Javascript
通俗解释JavaScript正则表达式快速记忆
2017/08/23 Javascript
Angularjs按需查询实例代码
2017/10/30 Javascript
NodeJS爬虫实例之糗事百科
2017/12/14 NodeJs
解决betterScroll在vue中存在图片时,出现拉不动的问题
2018/09/27 Javascript
nodejs中实现用户注册路由功能
2019/05/20 NodeJs
详解如何在JS代码中消灭for循环
2019/12/11 Javascript
React实现阿里云OSS上传文件的示例
2020/08/10 Javascript
从零学Python之入门(三)序列
2014/05/25 Python
Python虚拟环境Virtualenv使用教程
2015/05/18 Python
python根据文章标题内容自动生成摘要的实例
2019/02/21 Python
Python容器使用的5个技巧和2个误区总结
2019/09/26 Python
Python3.x+pyqtgraph实现数据可视化教程
2020/03/14 Python
selenium+python配置chrome浏览器的选项的实现
2020/03/18 Python
详解Python IO口多路复用
2020/06/17 Python
python实现单机五子棋
2020/08/28 Python
Python用dilb提取照片上人脸的示例
2020/10/26 Python
linux系统下pip升级报错的解决方法
2021/01/31 Python
英国布鲁姆精品店:Bloom Boutique
2018/03/01 全球购物
自考生毕业自我鉴定
2013/10/10 职场文书
自我评价正确写法范文
2013/12/10 职场文书
物流专业大学的自我评价
2014/01/11 职场文书
房产委托公证书
2014/04/08 职场文书
婚假请假条怎么写
2014/04/10 职场文书
业务内勤岗位职责
2014/04/30 职场文书
干部作风建设个人剖析材料
2014/10/11 职场文书
新店开张宣传语
2015/07/13 职场文书
队名及霸气口号大全
2015/12/25 职场文书
PHP连接MSSQL数据库案例,PHPWAMP多个PHP版本连接SQL Server数据库
2021/04/16 PHP
Python爬虫基础之爬虫的分类知识总结
2021/05/13 Python
新的CSS 伪类函数 :is() 和 :where()示例详解
2022/08/05 HTML / CSS