Image Processing - yszheda/wiki GitHub Wiki

Morphology

Binary morphology is set of fundamental operations on binary images (2-D sets of boolean values). It is a very simple, nonlinear convolution-like operation between two such sets. Unlike linear convolution, morphology takes the Min and Max of elements in the set. One set is the image per se; the other is the kernel of the convolution, which is called a structuring element and has a defined _origin _(sometimes called the "center").

The basic binary morphology operations are dilation and erosion. In a binary image, we refer to the foreground (black) pixels variously as "black", "foreground", "ON" or "1". We refer to the background (white) pixels variously as "white", "background", "OFF" or "0". Loosely speaking, dilation "smears" the foreground and erosion "thins" the foreground. These two operations are actually dual in that an erosion of the foreground is equivalent to a dilation of the background. Dilation can be implemented as follows: start with a cleared destination image (all OFF pixels). Then do a sequence of logical OR operations of the source image with the destination, each time with a specific shift, as determined by a pattern called a structuring element (Sel). The Sel is a 2-dimensional pattern of hits, all relative to an origin that is often referred to as the center of the Sel. It is a set as well. So there are really two sets involved in a morphological operation: the image and a Sel. For example, consider a Sel that is a horizontal pattern of 5 contiguous hits (x,y) = {(-2,0), (-1,0), (0,0), (1,0) and (2,0)}, with an origin at (0,0). Then a dilation of the image by this Sel involves initializing all dest pixels to OFF and then ORing the source five times with source shifts given by the five hits in the Sel.

The inversion of the Sel for erosion is also required to make the opening, which is a sequence of erosion followed by dilation, both using the same Sel, have the property called idempotence. This means that if you do a second opening, there is no change after the first one.

All four morphological operations have two important properties:

  1. Translational invariance. The operation commutes with translation: if you translate the source and perform an operation, you get the same result as if you performed the operation first and then translated the result.

  2. Increasing. If you have two images, one of which has a foreground that is entirely contained in the other, then the results of a morphological operation retain the same order of inclusion.

The opening is anti-extensive, which means that the set of ON pixels after opening is contained in the source image. Oppositely, the closing is extensive because the source image ON pixels are all contained in the image that results from closing it.


The Sel (structuring element) is a 2-dimensional pattern of hits, all relative to an origin that is often referred to as the center of the Sel. Opening and closing have the property called idempotence.

CUDA

connect components

CUDA

contours

ghost

FFT

Dark Field & Bright Field

NMS

opencv resize

stdfilt

IoU

line clipping