Skip to content

Instantly share code, notes, and snippets.

@YaronBlinder
Created August 8, 2016 20:58
Show Gist options
  • Save YaronBlinder/7fd44818d581865febdaa21bb77449c0 to your computer and use it in GitHub Desktop.
Save YaronBlinder/7fd44818d581865febdaa21bb77449c0 to your computer and use it in GitHub Desktop.
def im2double_m(img, *args, **kwargs):
# return normalize(img.astype(np.float64), None, 0.0, 1.0, NORM_MINMAX)
img = img.astype(np.float64)
min_val = np.min(img.ravel())
max_val = np.max(img.ravel())
out = img*max_val/(max_val - min_val)
out = out/(255.0)
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment