Image Filtering

作者: Kulbear | 来源:发表于2017-02-05 17:30 被阅读0次

    You can find this article and source code at my GitHub

    Three views of filtering

    • Image filters in spatial domain
    • Filter is a mathematical operation of a grid of numbers
    • Smoothing, sharpening, measuring texture
    • Image filters in the frequency domain
    • Filtering is a way to modify the frequencies of images
    • Denoising, sampling, image compression
    • Templates and Image Pyramids
    • Filtering is a way to match a template to the image
    • Detection, coarse-to-fine registration

    Example

    Box filter

    • Replaces each pixel with an average of its neighborhood
    • Smoothing

    Given a 3-by-3 box filter in the graph below

    We will be able to find the filtered image, and the result looks like below (right one).

    We also have some other popular and useful filters.

    Sobel filter

    Vertical Sobel filter Horizontal Sobel filter

    Now you may think that a Sobel filter can be used to find the edge in an image. And you are right. I have tried to merge two result images from the vertical and horizontal


    Properties of linear filters

    Linearity:

    filter(f1 + f2) = filter(f1) + filter(f2)

    Shift invariance: same behavior regardless of
    pixel location

    filter(shift(f)) = shift(filter(f))

    Any linear, shift-invariant operator can be
    represented as a convolution


    Important filter: Gaussian

    Weight contributions of neighboring pixels by nearness

    Smoothing with Gaussian filter


    Smoothing with Gaussian filter

    Smoothing with box filter


    Smoothing with box filter

    A Gaussian filter can do this better since it keeps "more information" than a box filter by weighting contributions from neighbors.


    Practical matters

    How big should the filter be?

    • Values at edges should be near zero
    • Rule of thumb for Gaussian: set filter half-width to
      about 3σ

    What about near the edge?

    • the filter window falls off the edge of the image
    • need to extrapolate
    • methods:
    • clip filter (black)
    • wrap around
    • copy edge
    • reflect across edge

    What is the size of the output?


    Median filter

    • A Median Filter operates over a window by
      selecting the median intensity in the window.
    • What advantage does a median filter have over
      a mean filter? (Check the picture below!)
    • Is a median filter a kind of convolution?
    Comparison: salt and pepper noise

    Have you seen the superior advantage of applying a mean filter?


    Reference:

    Computer Vision: Algorithms and Applications by Richard Szeliski.
    CSCI 1430: Introduction to Computer Vision

    Thanks for reading. If you find any mistake / typo in this blog, please don't hesitate to let me know, you can reach me by email: jyang7[at]ualberta.ca

    相关文章

      网友评论

        本文标题:Image Filtering

        本文链接:https://www.haomeiwen.com/subject/bgmeittx.html