I have an image U, and when I want to convolve it with a box filter:
0 1 0
1 -4 1
0 1 0
I use imfilter function with a constant 2D array and there is no problem. But, when I have the following operation:
u(i,j) = v(i-1,j)^2 * u(i-1,j) + v(i+1,j)^2 * u(i+1,j) + v(i, j+1)^2 * u(i,j+1) + v(i,j-1)^2 * u(i,j-1)
(A simplified version of my filter). In other words, my filter to be used over image U is related to the pixel values of image V, but in the same location which the filter is applied. Is there a way to implement such an operation in MATLAB, WITHOUT using nested for loops for each pixel?