How does image matrix filters work in matlab?

Click For Summary
To sharpen vertical spatial lines in an image using MATLAB, a highpass filter matrix is created and applied through convolution. The matrix hp is designed to enhance contrast by subtracting light from neighboring pixels while adding it to the center pixel, effectively reversing the blurring effect. This process increases the brightness of high-value pixels more than low-value ones, addressing the light diffusion caused by blurring. Understanding this mechanism clarifies why the highpass filter can sharpen rather than blur the image. Overall, the sharpening technique aims to restore image clarity by enhancing pixel contrast.
Addez123
Messages
199
Reaction score
21
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 don't see how a highpass filter would work.

Any one care to explain it in abit more detail?
 
Physics news on Phys.org
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.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
718
  • · Replies 2 ·
Replies
2
Views
5K
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K