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.
- 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.
- 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:
- 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.
- 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:
- “imgaussfilt” function: https://www.mathworks.com/help/images/ref/imgaussfilt.html
- 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
- 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!