Example #1
0
def blackTopHat(imIn, imOut, n, se=mamba.DEFAULT_SE):
    """
    Performs a black Top Hat operation on 'imIn' and puts the result in 'imOut'.
    This operator extracts from 'imIn' the dark objects thinner than 2*'n'+1. 
    
    The structuring element used is defined by 'se' ('DEFAULT_SE' by default).
    """
    
    imWrk = mamba.imageMb(imIn)
    mamba.closing(imIn, imWrk, n, se=se)
    mamba.sub(imWrk, imIn, imOut)
Example #2
0
def alternateFilter(imIn, imOut,n, openFirst, se=mamba.DEFAULT_SE):
    """
    Performs an alternate filter operation of size 'n' on image 'imIn' and puts
    the result in 'imOut'. If 'openFirst' is True, the filter begins with an
    opening, a closing otherwise.
    """
    
    if openFirst:
        mamba.opening(imIn, imOut, n, se=se)
        mamba.closing(imOut, imOut, n, se=se)
    else:
        mamba.closing(imIn, imOut, n, se=se)
        mamba.opening(imOut, imOut, n, se=se)
Example #3
0
def fullAlternateFilter(imIn, imOut, n, openFirst, se=mamba.DEFAULT_SE):
    """
    Performs a full alternate filter operation (successive alternate filters of
    increasing sizes, from 1 to 'n') on image 'imIn' and puts the result 
    in 'imOut'. 'n' controls the filter size. If 'openFirst' is True, the filter
    begins with an opening, a closing otherwise.
    """
    
    mamba.copy(imIn, imOut)
    for i in range(1,n+1):
        if openFirst:
            mamba.opening(imOut, imOut, i, se=se)
            mamba.closing(imOut, imOut, i, se=se)
        else:
            mamba.closing(imOut, imOut, i, se=se)
            mamba.opening(imOut, imOut, i, se=se)