how do i perform local normalization of fingerprint image. please correct this code the sise of my image is 480x640
Afficher commentaires plus anciens
clc;
I1=imread('D:/aa.png');
I1=imresize(I1,[450,600])
I= im2double(I1);
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
drawnow;
[rows columns numberOfColorBands] = size(I)
disp([rows columns numberOfColorBands]);
blockSizeR = 150; % Rows in block.
blockSizeC = 100; % Columns in block.
plotIndex = 1;
numPlotsR = size(ca, 1);
numPlotsC = size(ca, 2);
for r = 1 : numPlotsR
for c = 1 : numPlotsC
fprintf('plotindex = %d, c=%d, r=%d\n', plotIndex, c, r);
% Specify the location for display of the image.
subplot(numPlotsR, numPlotsC, plotIndex);
rgbBlock = ca{r,c};
imshow(rgbBlock); % Could call imshow(ca{r,c}) if you wanted to.
[rowsB columnsB numberOfColorBandsB] = size(rgbBlock);
caption = sprintf('Block #%d of %d\n%d rows by %d columns', ...
plotIndex, numPlotsR*numPlotsC, rowsB, columnsB);
title(captio);
drawnow;
plotIndex = plotIndex + 1;
end
end
subplot(4, 6, 1);
imshow(I);
title('Original Image');
*m1=128;
v1=128*128;
for l=1:8
for k=1:8
m = mean(ca{l});
v(k)=var(ca{l}(:));
coeff(k)=v(k)/v1;
end
end
for k=1:8
for i=1:120
for j=1:160
norimg(i, j) = m1 + coeff(k) .* (I1(i, j) - m(k) );
end
end
end*
_for i=1:120
for j=1:160
figure,imshow(norimg(i, j));
end
end
_
4 commentaires
Walter Roberson
le 11 Jan 2013
Why are you trying to show 120 times 160 images? Why are you not using just a simple
imshow(norimg)
with no loop?
Image Analyst
le 11 Jan 2013
And why are you referring to ca{l} when ca is a 2D array? Plus other errors too numerous to detail. I think you had better think this over a lot and then post again later.
Walter Roberson
le 11 Jan 2013
"ca" is undefined
Image Analyst
le 11 Jan 2013
Modifié(e) : Image Analyst
le 11 Jan 2013
Yes, it's a version of my "split an image up into blocks" code I've posted before but he pretty much didn't understand it, and then it just got worse when he tried to adapt it, like when he took out the line:
ca = mat2cell(rgbImage, blockVectorR, blockVectorC, numberOfColorBands);
I'd help but I'm not sure what he wants to do. I'd have to study it more to figure it out and fix it, but I don't have time tonight.
Réponses (1)
Thorsten
le 11 Jan 2013
It's a one-liner
X = blkproc(I, [150 100], @(x) (0.5 + x - mean2(x))./(std2(x)/0.25));
You may want to change the normalizing function. Note that after im2double the image values are mapped form [0, 255] to the range [0, 1], that's why I have replaced your 128 values by 0.5.
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!