def find_windows_from_heatmap(image):
hot_windows = []
# Threshold the heatmap
thres = 0
image[image <= thres] = 0
# Set labels
labels = ndi.label(image)
# iterate through labels and find windows
for car_number in range(1, labels[1]+1):
# Find pixels with each car_number label value
nonzero = (labels[0] == car_number).nonzero()
# Identify x and y values of those pixels
nonzeroy = np.array(nonzero[0])
nonzerox = np.array(nonzero[1])
# Define a bounding box based on min/max x and y
bbox = ((np.min(nonzerox), np.min(nonzeroy)), (np.max(nonzerox), np.max(nonzeroy)))
hot_windows.append(bbox)
return hot_windows
lesson_functions.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录