MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / _impl

Method _impl

tensorpack/dataflow/imgaug/paste.py:78–87  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

76 return TransformFactory(name=str(self), apply_image=lambda img: self._impl(img))
77
78 def _impl(self, img):
79 img_shape = img.shape[:2]
80 assert self.background_shape[0] >= img_shape[0] and self.background_shape[1] >= img_shape[1]
81
82 background = self.background_filler.fill(
83 self.background_shape, img)
84 y0 = int((self.background_shape[0] - img_shape[0]) * 0.5)
85 x0 = int((self.background_shape[1] - img_shape[1]) * 0.5)
86 background[y0:y0 + img_shape[0], x0:x0 + img_shape[1]] = img
87 return background
88
89
90class RandomPaste(CenterPaste):

Callers 1

get_transformMethod · 0.95

Calls 1

fillMethod · 0.80

Tested by

no test coverage detected