# What is an efficient way to get blur from source and blurred images?

I'm doing little program to get blur from source image and blurred image. But I haven't learned so much things about math in school yet.

The equation used for blurring the image A into B:

B(x,y) = A(x-1,y-1)*C(0,0) + A(x,y-1)*C(1,0) + A(x+1,y-1)*C(2,0) +
A(x-1,y)  *C(0,1) + A(x,y)  *C(1,1) + A(x+1,y)  *C(2,1) +
A(x-1,y+1)*C(0,2) + A(x,y+1)*C(1,2) + A(x+1,y+1)*C(2,2)


So what efficient way to solve it?

• Suggestion: before attacking this, invest some time with the simpler (but conceptually similar) problem in one dimension. – leonbloy Jul 8 '11 at 23:08

The difference is two-fold. First, there are now $3\times3$ different $A$ values and $3\times3$ different $C$ values and just one $B$ value, so even taken by itself this would be a different problem.
Further, if this describes an image blurring operation, then you're applying this operation for all values of $x,y$ in the blurred image, and different $B$ values will involve the same $A$ values; e.g. $A(3,4)$ occurs both in $B(3,4)$ and in $B(3,3)$.
Thus, to invert this operation, it's not enough to solve one $3\times3$ system of linear equations; the entire operation on the entire image has to be inverted. This is a non-trivial subject; Emre's answer has some pointers to get you started.