Normalizing by means of zero-mean
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello friends,
I am working on retinal images and need to make them standard before processing, because some images are dark others are very light. So before processing I am doing the following:
gemiddeld=mean2(DOG)
standaard_afwyking=std2(DOG)
NormalizedArray = (DOG-gemiddeld) ./ standaard_afwyking;
NormalizedArray =((NormalizedArray + 3)./ 6).*255
figure,imshow(NormalizedArray);
This is not working, because the output is just a blank white image.How can I fix this?
답변 (3개)
Jos (10584)
2013년 7월 18일
The problem is with the values you pass to IMSHOW. So, first read the help of imshow carefully
doc imshow
To fix this in your case, make sure NormalizedArray is, for instance, a true grayscale image
NormalizedArray = magic(50) ;
subplot(2,2,1) ; imshow(NormalizedArray)
GS = NormalizedArray ./ max(NormalizedArray(:)) ;
subplot(2,2,2) ; imshow(GS)
댓글 수: 0
Jan
2013년 7월 18일
What is the type of DOG? Notice, that if NormalizedArray is a double array, all values greater than 1.0 are saturated. The multiplication by 255 looks like you want the image stored as UINT8 array. Then perhaps this helps:
NormArrayU8 = uint8(((NormalizedArray + 3) ./ 6) .* 255);
댓글 수: 0
DGM
2024년 6월 5일
편집: DGM
2024년 6월 6일
I'm going to stick this here and close the duplicate threads. What's missing from this form of the question is that the input images are integer-class. It's not just that the output needs to be properly scaled for its class in order to display correctly. You're normalizing the image in integer class, so your image is destroyed from rounding anyway.
Unless you're being careful, keep images properly-scaled for their class, and if you need to do gross rescaling or shifting outside the dynamic range of an integer class, then use floating point.
% an image of any standard numeric class
inpict = imread('tire.tif');
% parameters in unit scale
% these are the same as what's given
newmu = 1/2; % i.e. 3/6
newsig = 1/6;
inpict = im2double(inpict); % put the image in unit scale
mu = mean2(inpict);
sig = std2(inpict);
outpict = (inpict-mu)/sig;
outpict = outpict*newsig + newmu; % this is equivalent
% outpict = im2uint8(outpict); % if you want the output to always be uint8
[mu sig] % input statistics
[mean2(outpict) std2(outpict)] % output statistics
imshow(outpict,'border','tight');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!