warning: matrix is singular to working precision.

2 次查看(过去 30 天)
I am working on fingerprint feature vectors. Two feature vectors that i got as result are singular. I am getting this error while finding the mahalanobis distance between these two vectors. So is there any other way to overcome this error and get a precise solution.
  3 个评论
John D'Errico
John D'Errico 2017-10-27
编辑:John D'Errico 2017-10-27
Would you call your doctor up, tell them only that you feel ill, but refuse to visit the office, and refuse to tell them any more about the problem?
So, write better code that is robust to such a problem? Since we don't see what you did, how can anyone give a better answer? We cannot read your mind or the inside of your computer memory. Just seeing a huge mess of (typically poorly written) code will not help a lot either, but someone might be willing to wade through it. Really, someone would need to first, fully understand exactly how you are solving the problem, then wade through your code to see why it is not robust. Depending on the complexity of what you have done, this could literally take someone as long to debug as it took you to write the code.
You are the only one who knows the code you wrote. So, learn how to use the debugger. First, find where the problem occurs (a singular matrix.) Then understand why the problem occurs.
sai kumar
sai kumar 2017-10-27
编辑:sai kumar 2017-10-27
My apologies, I have downloaded the feature extraction module from this link: https://in.mathworks.com/matlabcentral/fileexchange/44369-fingerprint-matching--a-simple-approach?s_tid=srchtitle And i got singular feature vectors from this code.Here is where i used this feature extraction module:
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'});
im1 = imread([pathname,filename]);
axes(handles.axes1);
imshow(im1);
axes(handles.axes2);
fe1=ext_finger(im1,1);
set(handles.y,'String',mat2str(fe1));
setappdata(0,'y',fe1);
And here is where i used mahalanobis distance: x and y are the vectors
if true
dct=getappdata(0,'ct');
set(handles.dct,'String',mat2str(dct));
pk=getappdata(0,'pk');
mpk=getappdata(0,'mpk');
msk=pk(1,1);
pk(1,:)=[];
y=pk;
[s1,~]=size(dct);
for i=1:s1
if dct(i,1)==0
if dct(i,2)==0
if dct(i,3)==0
if dct(i,4)==0
if dct(i,5)==mpk
n=dct(i,6);
break;
end
end
end
end
end
end
c=zeros(i,6);
for j=1:i
for k=1:6
c(j,k)=dct(j,k);
end
end
c(j,:)=[];
while j~=0
dct(j,:)=[];
j=j-1;
end
x=dct;
d=mahal(x,y);
if(d<=15)
fprintf('>>fingerprints matched');
c1=reshape(c.',1,[]);
f=numel(c1);
e=1;
while e<6
if(c1(f)==0)
c1(f)=[];
f=f-1;
e=e+1;
else
break;
end
end
m1=zeros(1,f);
for h=1:f
m1(h)=mod(c1(h)^msk,n);
end
m=char(m1);
set(handles.dmessage,'String',m);
else
msgbox('fingerprint didnot match','invalid fingerprint','error');
end
I am very sorry, I am little bit new to matlab.

请先登录,再进行评论。

回答(2 个)

sai kumar
sai kumar 2017-10-27
My apologies, I have downloaded the feature extraction module from this link: https://in.mathworks.com/matlabcentral/fileexchange/44369-fingerprint-matching--a-simple-approach?s_tid=srchtitle And i got singular feature vectors from this code.Here is where i used this feature extraction module:
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'});
im1 = imread([pathname,filename]);
axes(handles.axes1);
imshow(im1);
axes(handles.axes2);
fe1=ext_finger(im1,1);
set(handles.y,'String',mat2str(fe1));
setappdata(0,'y',fe1);
And here is where i used mahalanobis distance: x and y are the vectors
if true
dct=getappdata(0,'ct');
set(handles.dct,'String',mat2str(dct));
pk=getappdata(0,'pk');
mpk=getappdata(0,'mpk');
msk=pk(1,1);
pk(1,:)=[];
y=pk;
[s1,~]=size(dct);
for i=1:s1
if dct(i,1)==0
if dct(i,2)==0
if dct(i,3)==0
if dct(i,4)==0
if dct(i,5)==mpk
n=dct(i,6);
break;
end
end
end
end
end
end
c=zeros(i,6);
for j=1:i
for k=1:6
c(j,k)=dct(j,k);
end
end
c(j,:)=[];
while j~=0
dct(j,:)=[];
j=j-1;
end
x=dct;
d=mahal(x,y);
if(d<=15)
fprintf('>>fingerprints matched');
c1=reshape(c.',1,[]);
f=numel(c1);
e=1;
while e<6
if(c1(f)==0)
c1(f)=[];
f=f-1;
e=e+1;
else
break;
end
end
m1=zeros(1,f);
for h=1:f
m1(h)=mod(c1(h)^msk,n);
end
m=char(m1);
set(handles.dmessage,'String',m);
else
msgbox('fingerprint didnot match','invalid fingerprint','error');
end
I am very sorry, I am little bit new to matlab.

sai kumar
sai kumar 2017-10-28
I am begging you please find me a solution.
  2 个评论
Jan
Jan 2017-10-28
Give us a chance to help you and ask a specific question. I do not even understand, what your problem is.
sai kumar
sai kumar 2017-10-28
编辑:sai kumar 2017-10-28
I have downloaded the feature extraction module from this link: https://in.mathworks.com/matlabcentral/fileexchange/44369-fingerprint-matching--a-simple-approach?s_tid=srchtitle And i got singular feature vectors from this code. I need to find mahalanobis distance of two feature vectors to match fingerprint. While i applying mahal(x,y), I got error that is - "matrix is singular to working precision." Is there any other way for me to get through this. please help me. And the code contains so many modules ,that is why i was not able to copy it. thank you.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by