How to determine the size of a disc in an averaging filter.

2 views (last 30 days)
Hello Everyone,
I was applying an averaging (disc) filter on my input image (say A), in order to get my final output image (say B). In my work, I was using disc size as 50 in the filter.
The code for this is:
global Im; % Where: Im = I/P Image
I = uint8(Im); % I = Unsigned Int(8) of Im
size = 50; % Disc Size
J1 = fspecial('disk', size); % Filter Parameter
K1 = imfilter(I,J1,'replicate'); % Actual Filter
Everything is fine and my output result is good as well. But I have a question. That is:
  1. Using Trial and Error Method, I have chosen the disc size as 50. That is, I tried a variety of disc sizes, but 50 was giving me a good result. So I am going with 50 as my disc size. My question is, how can I justify that 50 is the right size?. I mean, how a user can figure out an appropriate disc size in practice, i.e., without knowing in advance about an object being imaged?.
  2. I mean, instead of trial and error method, how can I determine the appropriate disc size?.
  3. Is there any general way to determine this?.
I would request you to please and kindly assist me in this regard.
Thanks in advance..

Accepted Answer

Raunak Gupta
Raunak Gupta on 21 Jan 2020
Hi,
Since the filter that is mentioned is an averaging filter the size of the filter i.e. the disc size is a hyperparameter that need to be set while working with any kind of filters. Estimating the size will require to have a comparison with something that is ground truth (or can be described as perfect). Since the ground truth cannot be generalized for every image by estimating the parameters of one image, the disc size cannot be estimated with good accuracy for all the images.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!