how does the image laplacian filter change with its shape?

5 ビュー (過去 30 日間)
Ge Mu
Ge Mu 2018 年 6 月 13 日
編集済み: Ge Mu 2018 年 6 月 14 日
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 件のコメント
Ge Mu
Ge Mu 2018 年 6 月 13 日
編集済み: Ge Mu 2018 年 6 月 14 日
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.

サインインしてコメントする。

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 6 月 13 日
  4 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 6 月 13 日
編集済み: KALYAN ACHARJYA 2018 年 6 月 13 日
Normalization: Multiply and Add all elements its gives 0
Is the question Answered?
Ge Mu
Ge Mu 2018 年 6 月 14 日
編集済み: Ge Mu 2018 年 6 月 14 日
no. Any factor in front will give the sum of elements 0. so why 4/(alpha+1)?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by