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

Class ImageEncode

examples/SuperResolution/data_sampler.py:47–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46
47class ImageEncode(MapDataComponent):
48 def __init__(self, ds, mode='.jpg', dtype=np.uint8, index=0):
49 def func(img):
50 img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
51 return np.asarray(bytearray(cv2.imencode(mode, img)[1].tostring()), dtype=dtype)
52 super(ImageEncode, self).__init__(ds, func, index=index)
53
54
55class ImageDecode(MapDataComponent):

Callers 1

data_sampler.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected