hello, i wanna do iris recognition by compare an iris image template on axes1 with a folder that filled with iris image templates, the iris image template from the folder with lowest hamming distance value will be the output and displayed on axes2.

11 views (last 30 days)
here is the codes that i have so far:
function buttonpencocokan_Callback(hObject, eventdata, handles)
gettraining=get(handles.txtketlatih, 'String');
datapath = (gettraining);
testpath = ('F:\Skripsi\Citra Uji');
s = get(handles.txtcitrauji, 'String');
file = char(s);
[pathstr,name,ext] = fileparts(file);
TestImage = strcat([pathstr],'\',[name,ext]);
recog_img = hammingdist(datapath,TestImage);
selected_img = strcat(datapath,'\',recog_img);
select_img = imread(selected_img);
test_img = imread(TestImage);
set(handles.axes2, 'Visible', 'Off');
result = strcat(recog_img);
S = get(handles.txtnmlatih, 'string');
N = cell2mat(regexp(S, '\d+', 'match'));
idx = get(handles.txtid, 'string');
idxi = str2num(idx);
idx = num2str( ceil( idxi / 1) );
sqlquery = ['select * from irismata where id =' '''' idx ''''];
biodata = exec(conn,sqlquery);
biodata = fetch(biodata);
ambil = get(handles.txtnmuji, 'string');
set(handles.txtketuji, 'String', ambil);
ambil2 = get(handles.txtnama, 'string');
set(handles.txtketlatih, 'String', ambil2);

Accepted Answer

Walter Roberson
Walter Roberson on 12 Jun 2017
You have
recog_img = hammingdistance(datapath,TestImage);
Mathworks does not provide a hammingdistance function so I do not know exactly what the function returns, but it is pretty likely that it is a numeric value, possibly an integer. In the situation of an exact match, we can guess that the value it would return would be 0, by definition of hamming distance.
You then have
selected_img = strcat(datapath,'\',recog_img);
Now in the case where recog_img is indeed numeric, then this would be equivalent to
selected_img = strcat(datapath, '\', char(recog_img) );
and in particular when recog_img is numeric 0, this would be
selected_img = strcat(datapath, '\', char(0) );
char(0), the very first character in the ASCII (or ISO, or Unicode) character sets, is formally known as NUL, or less formally as the null character -- much the same way that char(13) is formally known as CR, or less formally as carriage return. And the thing about char(0), NUL, is that it is not permitted in a file name in MS Windows -- not in the shells, not in the FAT file system, nor in NTFS file system. So when you accidentally put one into a file name, the program complains.
char(0) is not the same thing as '0' . Each character has an associated position in the character code tables, and it is the positions that are computed with rather than the graphic representation of the character. The graphic representation of the digit for zero, '0', is at position #48, for various reasons.
If you want numeric 0 to become '0' for the purpose of selected_img you need to convert the numeric to string, such as
selected_img = fullfile(datapath, num2str(recog_img) );

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!