Create The Image Laplacian Matrix Effectively

조회 수: 6 (최근 30일)
Royi Avital
Royi Avital 2014년 6월 3일
댓글: Royi Avital 2014년 6월 8일
Hello,
I want to build the Spatial Laplacian of a given operation on an image.
The Matrix is given by:
The matrix Dx / Dy is the forward difference operator -> Hence its transpose is the backward difference operator.
The matrix Ax / Ay is diagonal matrix with weights which are function of the gradient of the image.
It is defined by:
Where Ix(i) is the horizontal gradient of the input image at the i-th pixel.
As said above Ax(i, j) = 0, i ~= j.
It is the same for Ay with the direction modification.
Assuming input Image G -> g = vec(G) = G(:).
I want to find and image U -> u = vec(U) = U(:) s.t.:
How can I solve it most efficiently in MATLAB?
How should I build the sparse Matrices?
Thank You.
  댓글 수: 2
Matt J
Matt J 2014년 6월 4일
It looks like deconvreg in the Image Processing Toolbox does the above (or something similar), but without linear algebraic methods, probably.
Royi Avital
Royi Avital 2014년 6월 8일
I don't think deconvreg is related.

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2014년 6월 3일
[M,N]=size(inputImage);
g=inputImage(:);
Dx=diff(speye(N),1,1);
Dx=kron(Dx,speye(M));
Dy=diff(speye(M),1,1);
Dy=kron(speye(N),Dy);
sp=@(V) spdiags(V(:),0,numel(V),numel(V));
Ax=sp(Dx*g);
Ay=sp(Dy*g);
Lg=Dx.'*Ax*Dx + Dy.'*Ay*Dy;
u=(speye(size(Lg))+lambda*Lg)\g;
  댓글 수: 2
Royi Avital
Royi Avital 2014년 6월 3일
편집: Royi Avital 2014년 6월 3일
Hi Mat,
Thank you for your answer.
Few remarks:
  1. Wouldn't be faster to use 'diff' and then put it into the sparse matrix instead of doing it by matrix multiplication?
  2. Let's say the weights are given by exponent weight (See my update to the question). How would you do it?
Matt J
Matt J 2014년 6월 3일
Hi Royi,
  1. Yes, probably.
  2. Ax=sp(exp(-(Dx*g)/2/alpha^2)). Or implement Dx*g using diff() as you mentioned.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by