Create a 7x7 convolution kernel which has an equivalent effect to three passes with a 3x3 mean filter.

16 views (last 30 days)
How do I create a 7x7 convolution kernel that would have the have the same effect as 3 passes of a 3x3 mean filter. Assume I have a picture thats 7x7, just trying to quicken up the process but unsure of the kernel values.
  1 Comment
Rik
Rik on 11 Jan 2021
You can find guidelines for posting homework on this forum here. If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks). If your main issue is with understanding the underlying concept, you may consider re-reading the material you teacher provided and ask them for further clarification.

Sign in to comment.

Answers (1)

Steve Eddins
Steve Eddins on 11 Jan 2021
Convolution is associative:
Associativity of convolution
So, your 7x7 convolution kernel would be the convolution of the mean filters:
Use the 'full' option of conv2 to do this.
Note: I wouldn't necessarily expect convolving once with 7x7 to be faster than convolving three times with 3x3 filters. Convolving with a 7x7 filter is 49 multiplications and adds per pixel, whereas convolving three times with 3x3 filters is 3 times 9 = 27 multiplications and adds per pixel.
There is some overhead (such as memory allocation and input processing) associated with each convolution operation, so execution time is not just about counting floating-point operations. Generally, though, decomposing a larger filter into a sequence of smaller filters is a technique used to speed up operations, not slow them down.

Community Treasure Hunt

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

Start Hunting!