1. Spatial domain – Constitute all the pixels in an image. Real distance of image
2.Frequency domain – Fourier transformation of Image range
Filtering
• Using filter or mask
• Move two dimensional square window across the image (Affecting only one pixel at a time)
• Coefficient : Determine the effects of the filter ,also image
• Filter overlap sub-image
• Filtered New_img(i,j) = Σ(Coefficient in filter * Pixel of sub-image)
• This process has to be repeated for every pixel of image
• Filter is also known as the convolution kernel
Padding
• Convolution operation has to be performed at every pixel
• Since the pixel values do not exist outside the boundary, new values have to be created prior to convolution
• The padded pixels can be assumed to be either zero or a constant value
- Zero padding : All padded pixels are assigned a value of zero
- Constant padding : The constant value can be chosen based on the type of image
- Nearest neighbor : The value from the last row or column
- Reflect : Reflect values across the boundary of image
Mean Filter
• Image is divided by the number of pixels in the filter
• Toavoidscalingthepixelintensityafter filtering
• Linear filter
• Advantages of the mean filter
- Removes noise
• Disadvantages of the mean filter
- In the process of smoothing, the edges get blurred
- Reduces the spatial resolution of the image
• Mean filter does not have a scipy.ndimage module function
• We can use convolve function to achieve the intended result
Mean filtering
Median Filter
• Non-linear filter
• The median of these values is computed and is assigned to (i, j) in the filtered image
• Commonly used in removing salt-and-pepper noise and impulse noise
Max Filter
• Maximum value in the sub-image replaces the value at (i,j)
• Max filter enhances the bright points in an image
• The Python function for the maximum filter has the same arguments as the median filter discussed above
Max filter - size 3
Max filter - size 5
Edge Detection using Derivatives
• Edges are a set of points in an image where there is a change of intensity
• Changes in intensity can be measured by using the first or second derivative
• At the edge, first derivative is peak, second derivative is zero
Sobel filter
• The Sobel filter or mask is used to find horizontal and vertical edges (most popular first derivative filter)
• Multiply the sub-image with Sobel masks
모든 축의 edge amsk를 적용시켰을 때의 결과
•Detect vertical and horizontal edges using sobel
수평 방향의 sobel 필터를 적용
수직 방향의 sobel 필터를 적용
•Features of the Sobel filter
• The sum of the coefficients in the mask image is 0. This means that the pixels with constant grayscale are not affected by the derivative filter.
• The side effect of derivative filters is creation of additional noise. Hence, coefficients of +2 and −2 are used in the mask image to produce smoothing.
prewitt filter
prewitt 필터 적용
•Detect vertical and horizontal edges using prewitt
수평 방향의 prewitt 필터 적용
수직 방향의 prewitt 필터 적용
Canny filter
•Process of Canny filtering
1. The input of the Canny filter is a grayscale image
2. A Gaussian filter is used on the image for smoothing
3. Magnitude of the gradient, corresponding direction is computed
4. At the edge points, the first derivative will have either a minimum or a maximum. (Edge = Maximum gradient) These point are ‘ridge pixels’. To identify edge points and suppress others, only ridge tops are retained and other pixels are assigned a value of zero. This process is known as ‘Non-maximal suppression’.
5. Two thresholds are then used to threshold the ridges. Ridge pixel values help to classify edge pixels into weak and strong.
- Ridge pixels with values greater than the high threshold are classified as strong edge pixels.
- Ridge pixels with values lower than the low threshold are eliminated
- Ridge pixels between low threshold and high threshold are called weak edge pixels.
6. In the last step, the weak edge pixels are 8-connected with strong edge pixels.
댓글