how does the image laplacian filter change with its shape?

5 visualizaciones (últimos 30 días)
Ge Mu
Ge Mu el 13 de Jun. de 2018
Editada: Ge Mu el 14 de Jun. de 2018
when I call fspecial('laplacian', alpha) to obtain an laplacian filter for image processing, I get matrix with different scale:
I went into the code, it writes:
alpha = p2;
alpha = max(0,min(alpha,1));
h1 = alpha/(alpha+1); h2 = (1-alpha)/(alpha+1);
h = [h1 h2 h1;h2 -4/(alpha+1) h2;h1 h2 h1];
I think this promise the scale of the pixel value stay the same when you change the shape of the filter. So what certain rule does the code follow to make this happen?
  1 comentario
Ge Mu
Ge Mu el 13 de Jun. de 2018
Editada: Ge Mu el 14 de Jun. de 2018
In the document it writes:
My question is, why the factor 4/(1+alpha) in front, not any others? in Gaussian and LOG filter, there are normalization operation to ensure the sum of the filter template is 1. what is the normalization operation for Laplacian?
The reason I concern about this detail is that in OpenCV, for different shape, the output is [ 0 1 0 1 -4 1 0 1 0] for one, and [2 0 2 0 -8 0 2 0 2] for another. but MATLAB the latter one is scaled down by 4. The difference in scale will affect how much high order component I add to the original image. I think the shape should not affect this. I think MATLAB is accurate than OpenCV, I just want to know why. Hope I say this clearly.

Iniciar sesión para comentar.

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 13 de Jun. de 2018
  4 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 13 de Jun. de 2018
Editada: KALYAN ACHARJYA el 13 de Jun. de 2018
Normalization: Multiply and Add all elements its gives 0
Is the question Answered?
Ge Mu
Ge Mu el 14 de Jun. de 2018
Editada: Ge Mu el 14 de Jun. de 2018
no. Any factor in front will give the sum of elements 0. so why 4/(alpha+1)?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by