del2 function using convn and imfilter. Help

5 Ansichten (letzte 30 Tage)
Xavi
Xavi am 27 Mär. 2014
Bearbeitet: Xavi am 27 Mär. 2014
I am performing a diffusion regularization using the del2 function. My exercise consists to achieve the same result with convn and imfilter functions.
The code lines I need to change are:
uxuy = zeros(N,N,2);
...
grad_param = - 2*diff.*grad - lambda*4*[reshape(del2(uxuy(:,:,1)),[N*N,1]) reshape(del2(uxuy(:,:,2)),[N*N,1])];
Since I am working on a discrete domain, I've tried the following approach ( http://en.wikipedia.org/wiki/Discrete_Laplace_operator )
% Image Processing . 2D-filter
h_laplacian = [0 1 0; 1 -4 1 ; 0 1 0];
a1 = imfilter(uxuy(:,:,1), h_laplacian, 'replicate');
a2 = imfilter(uxuy(:,:,2), h_laplacian, 'replicate');
grad_param = - 2*diff.*grad - lambda*4*[reshape(a1,[N*N,1]) reshape(a2,[N*N,1])];
, but under the same conditions the result is not the same ( http://imgur.com/a/xwARZ )
So far I am not using the convn function. What am I doing wrong? Can anyone give me some hints?
Cheers.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by