Morphological contrast enhancement

The morphological contrast enhancement filter operates on each pixel by considering only the pixels in a neighborhood defined by a structuring element. It replaces the central pixel either by the local minimum or the local maximum pixel in the neighborhood, depending on which one the original pixel is closest to. The following code block shows a comparison of the output obtained using the morphological contrast enhancement filter and the exposure module's adaptive histogram equalization, with both the filters being local:

from skimage.filters.rank import enhance_contrastdef plot_gray_image(ax, image, title):    ax.imshow(image, vmin=0, vmax=255, cmap=pylab.cm.gray), ax.set_title(title), ax.axis('off') ax.set_adjustable('box-forced') ...

Get Hands-On Image Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.