Today small for everyone to share a python examples of painting three-dimensional trajectories and compare has a good reference value, we want to help. Come and see, to follow the small series together
a. Format of the data
First, we need x, y, z data drawing three. Examples KITTI 00.txt from the dataset used in this experiment:
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
A group of 12 data, corresponding to T = {R, t}, R is a 3 × 3 matrix, t is a 3 × 1 matrix. What we need is t data.
Some groundtruth data is 8, a first timestamp, a three x, y, z, data is behind the four quaternion.
code show as below:
# 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()
Renderings (computer more garbage, back when the tracking of the extracted feature points too):
examples of this python draw more than 3-dimensional trajectories and compared is small series to share the entire contents of all of the
content on the above multi-how Finally, we recommend a number of well-regarded public universities [programmers], there are a lot of old-timers learning skills, learning experience, interview skills, workplace experience and other share, the more we carefully prepared the zero-based introductory information, real items information every day to explain the timing of Python programmers technology, and share some learning methods need to pay attention to small details