MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / overlay

Function overlay

samples/python/detectron2/visualize.py:44–50  ·  view source on GitHub ↗
(image, mask, color, alpha_transparency=0.5)

Source from the content-addressed store, hash-verified

42
43#Overlay mask with transparency on top of the image.
44def overlay(image, mask, color, alpha_transparency=0.5):
45 for channel in range(3):
46 image[:, :, channel] = np.where(mask == 1,
47 image[:, :, channel] *
48 (1 - alpha_transparency) + alpha_transparency * color[channel] * 255,
49 image[:, :, channel])
50 return image
51
52def visualize_detections(image_path, output_path, detections, labels=[], iou_threshold=0.5):
53 image = Image.open(image_path).convert(mode='RGB')

Callers 1

visualize_detectionsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected