def filmhwa_min_s(I, r=4, sigma_s=2.0, sigma_c=0.1, s=0.25, alpha=0.6, beta=0.15):
I_lin = to_linear(I)
O = zeros_like(I_lin)
for p in pixels(I_lin):
W = window(p, r)
ws = exp(-dist2(p,W)/(2*sigma_s**2))
dc = color_dist(I_lin[p], I_lin[W])
wc = exp(-dc**2/(2*sigma_c**2))
w = ws * wc
S1 = w.sum()
S2 = (w**2 / I_lin[W]).sum(axis=0) # channel-wise
H = (S1**2) / (S2 + 1e-8)
m = H.min(axis=channel)
for c in channels:
O[c,p] = (1-s)*H[c] + s*(m + alpha*(I_lin[c,p]-m))
if beta>0:
guided = guided_blur(I_lin, r=2)
residual = I_lin - guided
O = O + beta * residual
return to_srgb(O)
Because Filmhwa does not sell direct to consumers, use these authorized channels:
Warning: Counterfeit Filmhwa filters exist. Genuine Min-S cartridges have:
The minus sign (-) tells Google, Bing, or any advanced search engine: exclude pages containing this word.