peak_local_max函数参数
时间: 2023-06-21 10:05:26 浏览: 165
peak_local_max函数是用于在局部最大值点处找到峰值的函数,它的参数如下:
1. image:输入的图像。
2. min_distance:两个峰之间的最小距离。如果两个峰之间的距离小于该值,则只有第一个峰被标记。
3. threshold_abs:峰值最小阈值。只有峰值大于该值时,才会被标记。
4. threshold_rel:峰值相对于全局最大值的最小阈值。只有峰值相对于全局最大值大于该值时,才会被标记。
5. exclude_border:是否在边界上排除峰值。如果为True,则在图像边界上找到的峰值将被排除。
6. indices:如果为True,则返回峰值的坐标。如果为False,则返回布尔型数组,其中峰值处为True。
7. footprint:定义要在图像中搜索峰值的邻域形状。默认为3x3的正方形。
相关问题
def detect_grasps(q_img, ang_img, width_img=None, no_grasps=1): """ Detect grasps in a GG-CNN output. :param q_img: Q image network output :param ang_img: Angle image network output :param width_img: (optional) Width image network output :param no_grasps: Max number of grasps to return :return: list of Grasps """ local_max = peak_local_max(q_img, min_distance=20, threshold_abs=0.2, num_peaks=no_grasps)
`peak_local_max` 是一个用于在二维数组中查找局部最大值的函数,它将返回一个包含这些最大值的坐标数组。在这里,它用于查找 GG-CNN 输出中的局部最大值,以确定抓取点的位置。它有几个参数,包括 `min_distance`(最小距离,用于在找到一个最大值后从图像中删除其他最大值),`threshold_abs`(最小阈值,用于确定最大值),`num_peaks`(最大最大值数量,用于限制返回的结果)。
def detect_grasps(q_img, ang_img, width_img=None, no_grasps=1): """ Detect grasps in a GG-CNN output. :param q_img: Q image network output :param ang_img: Angle image network output :param width_img: (optional) Width image network output :param no_grasps: Max number of grasps to return :return: list of Grasps """ local_max = peak_local_max(q_img, min_distance=20, threshold_abs=0.2, num_peaks=no_grasps) grasps = [] for grasp_point_array in local_max: grasp_point = tuple(grasp_point_array) grasp_angle = ang_img[grasp_point] g = Grasp(grasp_point, grasp_angle) if width_img is not None: g.length = width_img[grasp_point] g.width = g.length/2 grasps.append(g) return grasps
这段代码是用来在机器人视觉中检测物体的抓取点的。它接收神经网络输出的 Q 图像和 Angle 图像,以及可选的 Width 图像,然后使用 peak_local_max 函数检测图像中的局部最大值,作为抓取点。然后,对于每个抓取点,该代码创建一个 `Grasp` 对象,将其添加到 `grasps` 列表中,并返回该列表。如果提供了 Width 图像,则还会为每个 `Grasp` 对象设置 length 和 width 的属性。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)