Error in image normalization

조회 수: 1 (최근 30일)
Matlab Student
Matlab Student 2018년 10월 6일
댓글: Matlab Student 2018년 10월 7일
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일
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일
Why not simply use imgradient()?
  댓글 수: 10
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.

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

Community Treasure Hunt

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

Start Hunting!

Translated by