def norm_reinhard(normalize_targets=False, with_params=False):
    """Normalize extracted patches based on modified Reinhard formula from: `Noise2Noise: Learning Image Restoration without Clean Data`
    https://arxiv.org/abs/1803.04189
    Best suited to HDR images

    Parameters
    ----------
    normalize_targets : boolean, optional
        Flag to enable normalization of target pacthes. See: https://arxiv.org/abs/1803.04189

    Return
    ------
    function
        Function that does modified Reinhard normalization to be used in :func:`create_patches`.

    """

    def _normalize(patches_x,patches_y, x,y,mask,channel):
        patches_x_norm = pow(patches_x/(1+patches_x),1/2.2)
        if(normalize_targets):
            patches_y_norm = pow(patches_y/(1+patches_y),1/2.2)
        else:
            patches_y_norm = patches_y

        return patches_x_norm, patches_y_norm

    if with_params:
        norm_params = f"{'RawTarget' if not normalize_targets else ''}"
        return _normalize, norm_params    
    else:
        return _normalize