Hello Team,
I have written this code to compute the normalization of a gradient image.
if true
% code
function [horDiffNorm, verDiffNorm] = normalization(H, V)
sumH = 0;
sumV = 0;
[rowsH, colsH, depthH] = size(H);
[rowsV, colsV, depthV] = size(V);
for jH = 1:1:rowsH
for iH = 1:1:colsH
for zH = 1:1:colsH
if (zH ~= iH)
sumH = sumH + power(H(jH, zH), 2);
end
end
horDiffNorm(jH, iH) = H(jH, iH)/ sqrt(double(1/(2*(colsH-1))*sumH));
end
end
end
end
I performed debugging and noticed the value of SumH reaches (255) at zH = 32 and then it stuck at 255, even though the next pixels are not 0.
Can you please help?

 採用された回答

Walter Roberson
Walter Roberson 2018 年 10 月 6 日

0 投票

Right after the function header put in
H = double(H) ;

1 件のコメント

Matlab Student
Matlab Student 2018 年 10 月 6 日
Working! Thanks Walter

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2018 年 10 月 6 日

0 投票

Why not simply use imgradient()?

10 件のコメント

Matlab Student
Matlab Student 2018 年 10 月 6 日
Thanks for you comment. I am new to Matlab and did not know about imgradient(). I need to perform normalization following the equation attached to this comment.
Matlab Student
Matlab Student 2018 年 10 月 6 日
Based on Matlab documentation, I can use this syntax: [Gmag,Gdir] = imgradient(I,method)
But the above equation is not listed under the available methods.
Am I right?
Image Analyst
Image Analyst 2018 年 10 月 6 日
What is that formula supposed to do? If you just want the gradient magnitude, why can't you just use imgradient()? What do you need to do AFTER that?
Matlab Student
Matlab Student 2018 年 10 月 6 日
編集済み: Matlab Student 2018 年 10 月 6 日
The value of every pixel should be divided by the square root of the summation of neighbors to the right and left of the subjective pixel
Dnormalize(x,y) = D(x,y)/sqrt(1/2N*summation(power(D(x+i,y),2)))
N is the number of neighbors to the left and right of the pixel (x,y)
Image Analyst
Image Analyst 2018 年 10 月 7 日
You're going all the way from the pixel to the extreme far right edge and extreme bottom edge, instead of just in a localized scanning window like usual. Why???
Matlab Student
Matlab Student 2018 年 10 月 7 日
I am a very beginner to Matlab and I don't know another way to do the same. What do you mean by "a localized scanning window" ?
If you can show me another professional and efficient way to do the same, it will be appreciated.
Matlab Student
Matlab Student 2018 年 10 月 7 日
Would you please check this out: https://www.mathworks.com/matlabcentral/answers/422634-analog-output-signal-after-applying-dft
Image Analyst
Image Analyst 2018 年 10 月 7 日
What are you trying to do with this unusual algorithm? A spatial filter? A convolution? A correlation? Why did you program it up in the first place?
What is H? Is it already the gradient image, or do you want to take the gradient of H?
Matlab Student
Matlab Student 2018 年 10 月 7 日
I am trying to implement a method designed to measure the blockiness of distorted images. This methods was proposed in "A Blind Reference-Free Blockiness Measure" paper for Chunhua Chen and Jeffrey A. Bloom (Dialogic Media Labs) and was published in 2010.
Matlab Student
Matlab Student 2018 年 10 月 7 日
I have already written the code, but while testing/ debugging it still need some modifications.

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

カテゴリ

ヘルプ センター および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by