MCPcopy Create free account
hub / github.com/LynnHo/EigenGAN-Tensorflow / imread

Function imread

scripts/imlib/basic.py:7–25  ·  view source on GitHub ↗

Return a float64 image in [-1.0, 1.0]. Parameters ---------- kwargs: To be passed to skimage.io.imread.

(path, as_gray=False, **kwargs)

Source from the content-addressed store, hash-verified

5
6
7def imread(path, as_gray=False, **kwargs):
8 """Return a float64 image in [-1.0, 1.0].
9
10 Parameters
11 ----------
12 kwargs:
13 To be passed to skimage.io.imread.
14
15 """
16 image = iio.imread(path, as_gray, **kwargs)
17 if image.dtype == np.uint8:
18 image = image / 127.5 - 1
19 elif image.dtype == np.uint16:
20 image = image / 32767.5 - 1
21 elif image.dtype in [np.float32, np.float64]:
22 image = image * 2 - 1.0
23 else:
24 raise Exception("Invalid image dtype: %s!" % image.dtype)
25 return image.astype(np.float64)
26
27
28def imwrite(image, path, quality=95, **plugin_args):

Callers 1

workFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected