import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def _get_gauss_response(self, img, gt):
# get the shape of the image..
height, width = img.shape#取图片的长宽
# 获取网格...
xx, yy = np.meshgrid(np.arange(width), np.arange(height))#画网格
# 得到物体的中心...
center_x = gt[0] + 0.5 * gt[2]
center_y = gt[1] + 0.5 * gt[3]
dist = (np.square(xx - center_x) + np.square(yy - center_y)) / (2 * self.args.sigma)
# 获取响应映射...
response = np.exp(-dist)
response = linear_mapping(response)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(xx, yy, response, cmap='jet')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.show()

从MOSSE复现代码中截取的部分
本文介绍了一种基于高斯分布生成响应映射的方法,并通过Python代码实现了该映射的可视化。具体步骤包括:获取图像尺寸,计算物体中心,根据高斯公式计算每个像素点的响应值,并使用matplotlib进行三维绘制。
5971

被折叠的 条评论
为什么被折叠?



