示例#1
0
def paddingMed(img, shape, shift=None, smooth=10):
    """
    pad with median
    see doc for paddingValue
    """
    try:
        med = N.median(img, axis=None)
    except TypeError: # numpy version < 1.1
        med = U.median(img)
    return paddingValue(img, shape, med, shift, smooth)
示例#2
0
def paddingMed(img, shape, shift=None, smooth=10):
    """
    pad with median
    see doc for paddingValue
    """
    try:
        med = N.median(img, axis=None)
    except TypeError:  # numpy version < 1.1
        med = U.median(img)
    return paddingValue(img, shape, med, shift, smooth)
示例#3
0
def maskEdgeWithValue2D(arr, val=None):
    """
    overwrite 2D image edge (s[:-2,2:]) with value **in place**
    
    if val is None, use median
    """
    if not val:
        val = U.median(arr[:-2,2:])
    arr[-2:] = val
    arr[:,:2] = val
    return arr
示例#4
0
def maskEdgeWithValue2D(arr, val=None):
    """
    overwrite 2D image edge (s[:-2,2:]) with value **in place**
    
    if val is None, use median
    """
    if not val:
        val = U.median(arr[:-2, 2:])
    arr[-2:] = val
    arr[:, :2] = val
    return arr