def supBlackTopHat(imIn, imOut, n, grid=mamba.DEFAULT_GRID): """ Performs a black Top Hat operation with the infimum of directional openings on 'imIn' and puts the result in 'imOut'. This operator partly extracts from 'imIn' the dark objects whose extension in at least one direction of 'grid' is smaller than 'n'. """ imWrk = mamba.imageMb(imIn) mamba.infClose(imIn, imWrk, n, grid=grid) mamba.sub(imWrk, imIn, imOut)
def linearAlternateFilter(imIn, imOut, n, openFirst, grid=mamba.DEFAULT_GRID): """ Performs an alternate filter operation on image 'imIn' with openings and closings by segments of size 'n' (supremum of openings and infimum of closings) and puts the result in 'imOut'. If 'openFirst' is True, the filter begins with an opening, a closing otherwise. """ if openFirst: mamba.supOpen(imIn, imOut, n, grid=grid) mamba.infClose(imOut, imOut, n, grid=grid) else: mamba.infClose(imIn, imOut, n, grid=grid) mamba.supOpen(imOut, imOut, n, grid=grid)