del2 function using convn and imfilter. Help
이전 댓글 표시
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.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Object Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!