This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from colorsys import rgb_to_hls, hls_to_rgb | |
def _rgb2hls(im): | |
return np.stack(np.vectorize(rgb_to_hls)(*im.transpose(2,0,1)/256), axis=-1) | |
def _hls2rgb(im): | |
return (255*np.stack(np.vectorize(hls_to_rgb)(*im.transpose(2,0,1)), axis=-1)).astype(np.uint8) | |
def invert(img): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from csbdeep.utils import normalize | |
def norm_minmse(gt, x, normalize_gt=True): | |
""" | |
normalizes and affinely scales an image pair such that the MSE is minimized | |
Parameters | |
---------- | |
gt: ndarray |
NewerOlder