can u pls explain it
이전 댓글 표시
function imOut = mean_imnorm(im)
% O = IMNORM(I)Image normalization
% imwrite doesnt seem to do any normalizing, so i do it here.
% normalizes to the range (0,1).
imOut = im;
% normalize
imMin = mean(imOut(:));
if (imMin < 0)
imOut = imOut + abs(imMin);
end
imOut = imOut ./ max(imOut(:));
채택된 답변
추가 답변 (1개)
dpb
2015년 6월 10일
0 개 추천
% normalizes to the range (0,1).
Excepting that it doesn't if mean(imOut(:))<0. In that case it adjusts by the average, but there must be values < average so they'll still be negative. For the normalization to be >= 0, the shift would have to be abs(min()) to move the smallest value to the zero point.
OTOH, if all initial values are >=0, then the if clause doesn't come into play and since the lower bound would then be 0, the final range will be [0,1].
That still leaves the case where there are individual values <0 but the mean >0; again the range output will not be constrained [0 1].
One presumes with the name this is an image and hence there aren't negative values so the problems may not show up but the routine doesn't do as advertised (if it makes a difference).
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!