def highlight_regions(image, region_rects):
# Darken image with mask
composite_image = cv2.addWeighted(image, 0.50, numpy.zeros(image.shape, dtype="uint8"), 0.50, 0)
# Highlight region_of_interest
for rect in region_rects:
(x1, x2, y1, y2) = (rect["x1"], rect["x2"], rect["y1"], rect["y2"])
composite_image[y1:y2, x1:x2] = image[y1:y2, x1:x2]
return composite_image
评论列表
文章目录