user3039976
user3039976

Reputation: 21

2D convolution by breaking up mask

Is there a way to perform convolution of two matrices (image and mask) by breaking up the mask into 2 smaller chunks and combining the result of the 2 convolutions to get the original single mask convolution result?

Upvotes: 2

Views: 164

Answers (1)

Chris A.
Chris A.

Reputation: 6887

Yes, due to linearity of convolution, you can break things up as:

I * M = I * (M1 + M2) = I * M1 + I * M2

where M is your original mask and M1 and M2 are the two smaller chunks.

For example, M could be

M = [ 1 1 2 
      2 1 3
      2 1 8 ]

and

M1 = [ 0 0 0
       0 1 3
       0 1 8 ]

M2 = [ 1 1 2 
       2 0 0 
       2 0 0 ]

Just be careful that if you do this, and you want to represent M1 as the smaller,

M1 = [ 1 3 
       1 8 ]

that you'll have to align them properly before you add them back together.

Upvotes: 1

Related Questions