Normalizing by means of zero-mean

조회 수: 3 (최근 30일)
Valeska Pearson
Valeska Pearson 2013년 7월 18일
편집: DGM 2024년 6월 6일
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?
  댓글 수: 1
Valeska Pearson
Valeska Pearson 2013년 7월 18일
DOG, is my difference of Gaussian image in the green channel.

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

답변 (3개)

Jos (10584)
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)

Jan
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);

DGM
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
ans = 1x2
0.2104 0.2438
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
[mean2(outpict) std2(outpict)] % output statistics
ans = 1x2
0.5000 0.1667
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
imshow(outpict,'border','tight');

카테고리

Help CenterFile Exchange에서 Image Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by