MCPcopy
hub / github.com/yosinski/deep-visualization-toolbox / to_255

Function to_255

image_misc.py:258–268  ·  view source on GitHub ↗

Convert vals in [0,1] to [0,255]

(vals_01)

Source from the content-addressed store, hash-verified

256
257
258def to_255(vals_01):
259 '''Convert vals in [0,1] to [0,255]'''
260 try:
261 ret = [v*255 for v in vals_01]
262 if type(vals_01) is tuple:
263 return tuple(ret)
264 else:
265 return ret
266 except TypeError:
267 # Not iterable (single int or float)
268 return vals_01*255
269
270
271def ensure_uint255_and_resize_to_fit(img, out_max_shape,

Callers 9

__init__Method · 0.90
_draw_control_paneMethod · 0.90
_draw_status_paneMethod · 0.90
_draw_layer_paneMethod · 0.90
_draw_aux_paneMethod · 0.90
_draw_back_paneMethod · 0.90
_draw_jpgvis_paneMethod · 0.90
draw_helpMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected