Hi, i am trying to run this code and facing problem. plz help.....!!!

I=imread('fingerprint.jpg');
imshow(I)
set(gcf,'position',[1 1 600 600]);
J=I(:,:,1)>160;
imshow(J)
set(gcf,'position',[1 1 600 600]);
K=bwmorph(~J,'thin','inf');
imshow(~K)
set(gcf,'position',[1 1 600 600]);
%filtering
fun=@minutie;
L = nlfilter(K,[3 3],fun);
%Termination
LTerm=(L==1);
imshow(LTerm)
LTermLab=bwlabel(LTerm);
propTerm=regionprops(LTermLab,'Centroid');
CentroidTerm=round(cat(1,propTerm(:).Centroid));
imshow(~K)
set(gcf,'position',[1 1 600 600]);
hold on
plot(CentroidTerm(:,1),CentroidTerm(:,2),'ro')
% "Bifurcation" code
LBif=(L==3);
LBifLab=bwlabel(LBif);
propBif=regionprops(LBifLab,'Centroid','Image');
CentroidBif=round(cat(1,propBif(:).Centroid));
plot(CentroidBif(:,1),CentroidBif(:,2),'go')
%upto 'Termination' ok ....but problem for "Bifurcation"
%MATLAB COMMAND WINDOE DISPLY
??? Index exceeds matrix dimensions.
Error in ==> ALL at 52
plot(CentroidBif(:,1),CentroidBif(:,2),'go')
WHAT CAN I DO NOW? plz...

2 commentaires

Image Analyst
Image Analyst le 12 Jan 2016
Modifié(e) : Image Analyst le 13 Jan 2016
What can you do now? You can attach 'Empreinte.bmp' so people can try your code and fix it.
I=imread('fingerprint.jpg');

Connectez-vous pour commenter.

Réponses (1)

If the result of your nlfilter does not include any values exactly equal to 3 then your
LBif=(L==3);
would be all 0, and there would be no regions for bwlabel to find and nothing for regionprops to act on. regionprops would return an empty matrix, the cat() would return an empty matrix, and there would be no columns to index in
plot(CentroidBif(:,1),CentroidBif(:,2),'go')
Your code should be testing that your LBif is not all false before you proceed to analyze the results.

1 commentaire

%nlfilter code here
H = fspecial('average', [3 3]);
L = imfilter(K, H);

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by