1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How does image matrix filters work in matlab?

  1. May 20, 2017 #1
    I got an image called img and I want to sharpen the vertical spatial lines.

    I created this matrix:
    hp = [-3 -2 -1 12 -1 -2 -3];
    hp= rot90(h_lowp);

    Then I do this to get the new image:
    newimg = uint8(conv2(single(hp), single(img)));

    It SORTA works, but I'm not so sure why it works.
    I mean all I do is multiply or substract neighbouring pixels, I don't see how that could do anything else but blur the image.
    I understand how a blurring lowpass matrix works, but I dont see how a highpass filter would work.

    Any one care to explain it in abit more detail?
  2. jcsd
  3. May 20, 2017 #2


    User Avatar
    Staff Emeritus
    Science Advisor

    I can't give you any details on how MatLab works, but the sharpening process in general attempts to reverse the blurring effect given by aberrations in the optical system or any other source of blurring. Blurring causes light that would be detected by a pixel to instead be detected by other nearby pixels. It essentially reduces the contrast of an image.

    Sharpening compares the values of nearby pixels and increases the contrast by subtracting some amount of light from neighboring pixels and adding into the center pixel. Pixels with low values of brightness will only have a small amount of light added to them, while pixels with high values of brightness will have lots of light added to them. This makes sense given that when you blur a bright pixel you remove a lot of light from the pixel (compared to a small amount of light from a dim pixel) and spread it around.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted