A 3x3 image kernel takes 9 multiplications and 8 or 9 additions for each pixel?

5 visualizzazioni (ultimi 30 giorni)
I doubt because you have 9 multiplications and you are adding 9 numberse together, when using a 3x3 convolution matrix.
Adding 9 numbers: 1+2+3+4+5+6+7+8+9
We are performing 8 additions as we repeat the operation of 'adding' 8 times (8 times a '+' sign).
We can say there are 9 additions as well, if you would accept a definition like: 0+1+2+3+4+5+6+7+8+9
But what does make more sense for computers: 8 adds or 9 adds?

Risposte (1)

Image Analyst
Image Analyst il 30 Mag 2013
For a 3 by 3 window there are not 8 additions, and not 9 additions. There are 3 additions and 3 multiplications, and 1 subtraction as the window slides along. You multiply the 3 numbers on the right by the filter, then add the 3 numbers to the right (2 additions) then add that sum to the sum of the filter (one more addition), then subtract off the sum of the left column. If you have a separable (symmetric) kernel, you have even fewer. Look up strategies for speeding up convolutions and linear filters, or read Steve's blog: http://blogs.mathworks.com/steve/2006/10/04/separable-convolution/ (which I seem to be referring people to more and more lately).

Categorie

Scopri di più su Image Processing and Computer Vision in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by