Log warning when bitdepth > 10

This commit is contained in:
Johannes Schönberger
2013-07-12 23:16:49 +02:00
parent 68461dbf00
commit 9a36e3b270
3 changed files with 18 additions and 0 deletions
+6
View File
@@ -27,6 +27,9 @@ References
import numpy as np
from skimage import img_as_ubyte
from ... import get_log
log = get_log()
from . import bilateral16_cy
from .generic import find_bitdepth
@@ -60,6 +63,9 @@ def _apply(func8, func16, image, selem, out, mask, shift_x, shift_y, s0, s1):
if out is None:
out = np.zeros(image.shape, dtype=np.uint16)
bitdepth = find_bitdepth(image)
if bitdepth > 10:
log.warn("Bitdepth of %d may result in bad rank filter "
"performance." % bitdepth)
func16(image, selem, shift_x=shift_x, shift_y=shift_y, mask=mask,
bitdepth=bitdepth + 1, out=out, s0=s0, s1=s1)
else:
+6
View File
@@ -17,6 +17,9 @@ References
import numpy as np
from skimage import img_as_ubyte, img_as_uint
from ... import get_log
log = get_log()
from . import generic8_cy, generic16_cy
@@ -60,6 +63,9 @@ def _apply(func8, func16, image, selem, out, mask, shift_x, shift_y):
if out is None:
out = np.zeros(image.shape, dtype=np.uint16)
bitdepth = find_bitdepth(image)
if bitdepth > 10:
log.warn("Bitdepth of %d may result in bad rank filter "
"performance." % bitdepth)
func16(image, selem, shift_x=shift_x, shift_y=shift_y, mask=mask,
bitdepth=bitdepth + 1, out=out)
+6
View File
@@ -23,6 +23,9 @@ References
import numpy as np
from skimage import img_as_ubyte
from ... import get_log
log = get_log()
from . import percentile8_cy, percentile16_cy
from .generic import find_bitdepth
@@ -59,6 +62,9 @@ def _apply(func8, func16, image, selem, out, mask, shift_x, shift_y, p0, p1):
if out is None:
out = np.zeros(image.shape, dtype=np.uint16)
bitdepth = find_bitdepth(image)
if bitdepth > 10:
log.warn("Bitdepth of %d may result in bad rank filter "
"performance." % bitdepth)
func16(image, selem, shift_x=shift_x, shift_y=shift_y, mask=mask,
bitdepth=bitdepth + 1, out=out, p0=p0, p1=p1)
else: