How does image matrix filters work in matlab?

Click For Summary
SUMMARY

This discussion focuses on the implementation of high-pass filters in MATLAB for image sharpening, specifically using the matrix hp = [-3 -2 -1 12 -1 -2 -3]. The user applies the conv2 function to convolve this filter with the image, resulting in a sharpened output. The process enhances contrast by subtracting light from neighboring pixels and redistributing it to the center pixel, effectively reversing the blurring caused by optical aberrations. The explanation clarifies that while the method may seem counterintuitive, it effectively increases the visibility of vertical spatial lines in the image.

PREREQUISITES
  • Understanding of MATLAB syntax and functions, particularly conv2
  • Knowledge of image processing concepts, specifically high-pass and low-pass filters
  • Familiarity with matrix operations and their application in image manipulation
  • Basic principles of pixel brightness and contrast adjustment
NEXT STEPS
  • Research the implementation of different high-pass filters in MATLAB
  • Learn about the effects of various convolution kernels on image quality
  • Explore advanced image processing techniques using MATLAB's Image Processing Toolbox
  • Investigate the mathematical foundations of image blurring and sharpening
USEFUL FOR

This discussion is beneficial for image processing enthusiasts, MATLAB users, and anyone interested in enhancing image quality through filtering techniques.

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
1K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
1
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K