如何画出高斯滤波器函数得到的高斯分布


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复现代码中截取的部分

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值