python 画3维轨迹图并进行比较的实例
作者:pj_find 时间:2023-12-09 21:00:18
一. 数据的格式
首先我们需要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()
效果图(电脑比较垃圾,后面的轨迹跟踪的时候提取的特征点太少):
来源:https://blog.csdn.net/pj_find/article/details/88248613
标签:python,3维,轨迹图
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Javascript脚本实现静态网页加密实例代码
2024-04-19 11:04:30
Django框架的使用教程路由请求响应的方法
2022-02-08 19:04:55
![](https://img.aspxhome.com/file/2023/5/135285_0s.jpg)
利用Python脚本生成sitemap.xml的实现方法
2021-03-16 22:32:32
Python数据可视化之Pyecharts使用详解
2022-10-19 17:31:12
![](https://img.aspxhome.com/file/2023/3/67783_0s.png)
Vue开发环境跨域访问问题
2023-07-02 17:07:34
Asp.net实现简单的文字水印
2007-08-24 09:28:00
Python中的getopt函数使用详解
2023-04-07 03:08:00
Python 生成 -1~1 之间的随机数矩阵方法
2023-08-03 17:35:22
![](https://img.aspxhome.com/file/2023/2/82682_0s.jpg)
基于python元祖与字典与集合的粗浅认识
2023-11-11 07:19:48
MobaXterm 安装使用图文教程
2022-12-07 19:05:13
![](https://img.aspxhome.com/file/2023/1/131801_0s.jpg)
利用Anaconda简单安装scrapy框架的方法
2021-05-28 15:47:13
![](https://img.aspxhome.com/file/2023/0/128760_0s.jpg)
在Vue中实现添加全局store
2024-05-03 15:12:38
![](https://img.aspxhome.com/file/2023/6/130186_0s.png)
Python 实现两个服务器之间文件的上传方法
2022-04-22 10:32:03
Sql server数据库优化
2010-04-06 19:17:00
Python中scatter散点图及颜色整理大全
2022-10-06 02:17:51
![](https://img.aspxhome.com/file/2023/2/83832_0s.png)
Python性能优化技巧
2021-06-29 12:48:32
Python使用lambda表达式对字典排序操作示例
2022-12-26 06:27:46
Oracle数据库安全策略分析 (三)
2010-07-31 13:24:00
Bottle框架中的装饰器类和描述符应用详解
2023-10-10 00:18:25
Python编程入门的一些基本知识
2023-09-07 00:07:24
![](https://img.aspxhome.com/file/2023/9/112019_0s.jpg)