MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / test_draw_binary_mask

Method test_draw_binary_mask

tests/test_visualizer.py:146–158  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

144 v.draw_instance_predictions(inst)
145
146 def test_draw_binary_mask(self):
147 img, boxes, _, _, masks = self._random_data()
148 img[:, :, 0] = 0 # remove red color
149 mask = masks[0]
150 mask_with_hole = np.zeros_like(mask).astype("uint8")
151 mask_with_hole = cv2.rectangle(mask_with_hole, (10, 10), (50, 50), 1, 5)
152
153 for m in [mask, mask_with_hole]:
154 v = Visualizer(img)
155 o = v.draw_binary_mask(m, color="red", text="test")
156 o = o.get_image().astype("float32")
157 # red color is drawn on the image
158 self.assertTrue(o[:, :, 0].sum() > 0)
159
160
161if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

_random_dataMethod · 0.95
draw_binary_maskMethod · 0.95
VisualizerClass · 0.90
get_imageMethod · 0.80

Tested by

no test coverage detected