rate = 1.464844 # 斜率为1时1点对应的距离
xx_group = np.linspace(1, chirp, chirp, dtype=int)
yy_group = np.linspace(1, range, range, dtype=int)
point_group = np.linspace(1, point, point, dtype=int)
count_i = 1
for count_i in range(frame):
time1 = time.time()
# 打开.bin文件
count_i = count_i + 1
b = open("ETH—" + str(count_i) + ".bin", 'rb')
print(count_i)
# data三维数组
n = [[[0] * antenna for x in range(point)] for x in range(chirp)]
for j in range(chirp):
for k in range(point):
for l in range(antenna):
data = b.read(3) # 每次输出3个字节
temp_imag_int = data.hex()[0:3] # 12位一个数,先虚后实
temp_real_int = data.hex()[3:6]
n[j][k][i] = complex(temp_real_int, temp_imag_int)
# 做RD数据处理
plt.clf()
fig = plt.gcf() # 获取当前图
fia = np.squeeze(radarcube[:, :, 2])
Y0 = fft(fia, point)
Y0_tmp = Y0 - Y0.mean(axis=0)
m = fft(Y0_tmp, chirp, axis=0)
Y1 = fftshift(fft(Y0_tmp, 16, axis=0), axes=0)
Y1_abs = abs(Y1)
zz_group = Y1_abs[:, 1:range] # 74个数 1-74
a2 = Axes3D(fig)
X, Y = np.meshgrid(yy_group * rate, xx_group)
a2.plot_surface(X, Y, zz_group)
plt.pause(0.00001) # 暂停时间
plt.ioff() # 关闭画图窗口Z
time2 = time.time()
print(time2 - time1)
plt.show()
PYTHON读原始文件,显示Range-Doppler
最新推荐文章于 2024-01-22 10:07:48 发布