I want to show the temperature based on the density.
Following are the function that Im using,
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
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.
Im calling it as follows,
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 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?