del2 function using convn and imfilter. Help
Show older comments
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])];
So far I am not using the convn function. What am I doing wrong? Can anyone give me some hints?
Cheers.
Answers (0)
Categories
Find more on Object Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!