Filter images with a low-pass Gaussian filter with a visual angle cutoff frequency of 8 cycles/degree

26 次查看(过去 30 天)
Hello Matlab Community,
I am looking to apply a low-pass Gaussian filter to a set of images, with a visual angle cutoff frequency of 8 cycles/degrees, but I honestly have no idea what this means in terms of applying a Gaussian filter to an image. We are trying to recreate a set of stimuli from another lab, and this is all the info I have regarding filtering the images.
If someone with more experience with image processing could explain what a visual angle cutoff frequency is, and how it relates to applying a Gaussian Filter or the imgaussfilt() function, that would be quite helpful.

回答(1 个)

Garmit Pant
Garmit Pant 2024-4-18
编辑:Garmit Pant 2024-4-18
Greetings Stephen
I’ll answer your question in two parts, addressing your request to provide a theoretical explanation for the key concepts of visual angle and cut-off frequency and then further tying that knowledge with a practical solution to your query.
  1. Visual Angle: This is a way to describe the size of an object as it appears from a viewer's perspective. It's determined by both the physical size of the object and the distance from the viewer.In the case of an image, the size of the image is considered.
  1. Cycles per degree and Cut-off frequency: Cycles per degree is the unit measure of spatial frequency, which in this context refers to how often features (like edges or patterns) repeat per degree of visual angle.A cutoff frequency of 8 cycles/degree means your filter should allow features that repeat up to 8 times within a degree of visual angle to pass through while attenuating (reducing) the intensity of features that repeat more frequently (finer details).
The MATLAB function imgaussfilt” requires the standard deviation (σ) of the Gaussian function to control the extent of blurring. You’ll need to find the standard deviation based on cut-off frequency to apply the Gaussian filter. The cut-off frequency can betranslated into a corresponding σ value for the Gaussian filter in the following way:
  1. First, the cut-off frequency needs to be calculated in the unit Cycles per image. This is the measure of the repetition of features over the entire image. This will require the measurement of both the dimension and the distance of the image from the viewer. For an image of width ‘w’ metres and at a distance of ‘D’ metres, the angle span of the image in degrees can be calculated as:
We can multiply the cycles per degree with the angle span of the image to get the cut-off frequency in cycles per image.
  1. There is a mathematical relation between the cut-off frequencies and the standard deviation of the Gaussian filter, namely:
k is a constant, and ‘w’ is the width of the image, and fc is the desired cut-off frequency in cycles per image. You can experiment with the value of ‘k’ to get a suitable standard deviation.
Once you have calculated the value of the standard deviation, you can apply the filter on the image using “imgaussfilt” as follows:
I = imread(path_to_your_image');
Iblur = imgaussfilt(I,sigmaCalculated);
As stated above, the calculations require additional information in the form of the width of the images and their distance from the viewer. The low-pass Gaussian filter can be applied as shown above after acquiring that information.
For further understanding, I would suggest you refer to the links to the MathWorks documentation and some additional resources given below:
  1. imgaussfilt” function: https://www.mathworks.com/help/images/ref/imgaussfilt.html
  2. Refer to this resource to understand the relation between standard deviation and cut-off frequency and how the values affect the result of the application of the filter: https://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15463-f13/www/proj2/www/rlai
  3. Refer to this resource to get a deeper understanding about different kinds of image filters relevant to your application and their effect on images: https://vciba.springeropen.com/articles/10.1186/s42492-019-0036-3
Hope you find the above explanation and suggestions useful!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by