tags: image processing

Segmentation is the process of grouping the same pixels that belong to the same object together. Edge detection is based on the discontinuity of intensity, in contrast, thresholding is based on the similarity of intensity.

Point Detection

A point detection filter with the following properties is used We know that maximum response for a pixel is , so after applying the above filter we should apply thresholding with the value just less than the maximum response to find the pixel, which is .

Line detection filters

The same idea is applied here. We will also use thresholding here for weaker responses. Detection filters must sum up to 0, so when there is not detected object, the output is 0.

A tip for me: If asked to design an object detection filter, just think about what we don’t want to detect and make the output value of that zero, and also make sure that the something that we don’t want to be present has a negative response. Just remember the line example that is broken with a pixel.

Edge detection

Filters like the Laplacian are used to detect edges, we can also use first derivative filters, since they also report the rate of change of intensity in an image. Gradient filters are like Sobel and Prewitt filters.

NOTE: Noise have a really bad effect on the derivatives and get worse on the higher order ones.

Gradient operators

All these filters basically do the same job, the only difference is in the weight they give to specific differences, but after all the calculate the gradient. Sobel filter applies smoothing to the image during differentiation, that can be proved by doing differentiation to the Gaussian filter with the prewitt (look here it is done in 1D) filter and it will give a Sobel filter.

Image Gradient

The gradient of the image also gives edge data and edge detection functionality. Advantage of using gradient operators that we can use them to get direction of change and its magnitude.

Canny edge detecion

When we do Canny edge detection, we first start by applying Gaussian filter, here we have the as a hyper-parameter, the larger it is the more smooth the image will be and that will lead to less but more higher level edges to be detected, the smaller the sigma more edges will be detected but we are also more suspect to noise.

Non-maximum suppression

After calculating the gradient we also calculate the direction of the gradient. We will use the direction of the gradient to apply non-maximum suppression. In canny edge detection we only want a single pixel to represent our edge so we move in the direction of the gradient and the pixel that has the maximum gradient magnitude is the only pixel left as it is, other pixels are left suppressed to 0. We do this operation for the whole edge.

Hysteresis thresholding

In hysteresis thresholding we have to thresholding values, a low and a high value. Pixel values above the high values are instantly considered as edges. Values lower than the low threshold are instantly rejected, we think that maybe noise has caused them. Values in the middle needs some consideration, we look at them and if there are pixels that are connected to them from above the high threshold value then we keep the whole edge, else we will reject them.