mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-01 02:01:00 +08:00
remove try/except in _denoise_chambolle_nd. just use the numpy 1.6 compatible case
This commit is contained in:
committed by
Gregory R. Lee
parent
4a0ad77780
commit
4bc4f0a169
@@ -175,12 +175,7 @@ def _denoise_tv_chambolle_nd(im, weight=0.2, eps=2.e-4, n_iter_max=200):
|
||||
g[slices_g] = np.diff(out, axis=ax)
|
||||
slices_g[ax] = slice(None)
|
||||
|
||||
try:
|
||||
norm = np.sqrt((g*g).sum(-1, keepdims=True))
|
||||
except:
|
||||
# no keepdims argument available prior to numpy 1.7
|
||||
norm = np.sqrt((g*g).sum(-1))[..., np.newaxis]
|
||||
|
||||
norm = np.sqrt((g*g).sum(-1))[..., np.newaxis]
|
||||
E += weight * norm.sum()
|
||||
norm *= 0.5 / weight
|
||||
norm += 1.
|
||||
|
||||
Reference in New Issue
Block a user