I need to generate the heat map of a object based on its position example: the detected green ball in a video frame . If it stays in a position for a long duration then that place should be red and the positions in the frame where the ball has passes for a short duration must be in blue in that way i need to generate a heat map . Thanks in advance
Well what you can do here is
1) First define a heatmap as the size of the image
heatmap = np.zeros_like(img[:,:,0]).astype(np.float)
2) Since you already have the detected object and its position, in the heatmap, add 1 to all pixels in the bounding box of the object.
heatmap[box[0][1]:box[1][1], box[0][0]:box[1][0]] += 1
3) you can than apply thresholding by setting all pixels which are below a threshold value in the heatmap to be 0. You can choose the threshold value to be 1 so that the region inside your bounding box remains in the heatmap
heatmap[heatmap <= threshold] = 0
来源:https://stackoverflow.com/questions/38077405/how-do-i-generate-a-heat-map-of-a-detected-object-based-on-its-position-using-op