Error in image normalization
이전 댓글 표시
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?
채택된 답변
추가 답변 (1개)
Image Analyst
2018년 10월 6일
0 개 추천
Why not simply use imgradient()?
댓글 수: 10
Matlab Student
2018년 10월 6일
Matlab Student
2018년 10월 6일
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
2018년 10월 6일
편집: Matlab Student
2018년 10월 6일
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
2018년 10월 7일
Matlab Student
2018년 10월 7일
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
2018년 10월 7일
Matlab Student
2018년 10월 7일
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!