阈值后温度为黑色

编程入门 行业动态 更新时间:2024-10-10 11:25:51
本文介绍了阈值后温度为黑色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想根据密度显示温度.

I want to show the temperature based on the density.

以下是Im使用的功能

def add_heat(heatmap, bbox_list): for i in range(len(bbox_list)): rect = trackers[i].get_position() heatmap[int(rect.left()):int(rect.top()), int(rect.right()):int(rect.bottom())] += 1 return heatmap def apply_threshold(heatmap, threshold): # Zero out pixels below the threshold heatmap[heatmap <= threshold] = 0 # Return thresholded map cv2.imwrite("heatmap.png",heatmap) return heatmap

  • add_heat函数将遍历跟踪器,并仅针对阈值调整那些特定区域上的热图.
  • apply_threshold会将低于阈值的所有像素转换为零.
  • add_heat function will loop through the trackers and will tweak the heatmap only on those specific areas for the thresholding
  • apply_threshold will convert all pixels to zero if it is below certain threshold.
  • 我这样称呼它,

    heat = np.zeros_like(frame[:, :, 0]).astype(np.float) heat = add_heat(heat,trackers) heat = apply_threshold(heat, 80) heatmap = np.clip(heat, 0, 255)

    trackers包含所有跟踪的坐标.但是,当我尝试显示最终结果时,它仍然是黑色的.我可以知道我在想什么吗?

    trackers contains all the tracked coordinates. however when i try to show the final result, it is still black. May i know what am i missing?

    推荐答案

    似乎您的问题出在这里:

    Seems like your problem lies in here:

    heatmap[int(rect.left()):int(rect.top()), int(rect.right()):int(rect.bottom())] += 1 return heatmap

    假设您想将热图与skimage一起使用,您可能应该这样做:

    Assuming you want to use the heatmap with something like skimage, you should probably do it like this:

    heatmap[top_row:bottom_row, leftmost_column:rightmost_column]

    在您的代码中它将如下所示:

    which in your code will look like this:

    heatmap[int(rect.bottom()):int(rect.top()), int(rect.left()):int(rect.right())] += 1 return heatmap

    您可能想了解有关numpy数组的更多信息. 当我看到此问题在哪里时,我能够说出正在发生什么情况起源.

    You may want to read a little more about numpy arrays. I was able to tell what is happening as I saw where this question originated.

    更多推荐

    阈值后温度为黑色

    本文发布于:2023-10-16 14:15:10,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1497809.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:阈值   温度   黑色

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!