currency recognition using image Processing Techniques in matlab

8 views (last 30 days)
I am getting "Unrecognized function or variable 'dist'".
Is there an atler for dist or what should i change in this code for it to work.
clear all;
close all;
clc;
[imname,impath]=uigetfile({'*.jpg;*.png'});
im=imread([impath,'/',imname]);
%preprocessing
%resize image
im=imresize(im,[128 128]);
%remove noise;
%seperate channels
r_channel=im(:,:,1);
b_channel=im(:,:,2);
g_channel=im(:,:,3);
%denoise each channel
r_channel=medfilt2(r_channel);
g_channel=medfilt2(g_channel);
b_channel=medfilt2(b_channel);
%restore channels
rgbim(:,:,1)=r_channel;
rgbim(:,:,2)=g_channel;
rgbim(:,:,3)=b_channel;
%featureextraction
fet=totalfeature(rgbim);
load db;
k=length(currency);
%disp(k);
for j=1:k
% disp(j)
D(j)=dist(fet',currency(1,j).feature);
end
[value,index]=min(D);
if value<.001
currency_name=currency(index).name;
fprintf('recognized currency is : ');
disp(currency_name)
else
disp('no matches found');
end
  2 Comments
KSSV
KSSV on 27 Jan 2022
To have the function dist you need to have nnet toolbox. Do you have it? Try
which dist
/MATLAB/toolbox/nnet/nnet/nndistance/dist.m

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 27 Jan 2022
You seem to be using https://www.mathworks.com/matlabcentral/fileexchange/47143-currency-recognition which does not define a dist() function
There is a dist() function that is part of the Neural Network Toolbox, which might possibly be the one being used.
  4 Comments

Sign in to comment.


KSSV
KSSV on 27 Jan 2022
dist is a simple function, this calculates Euclidean distance weight function. You can do it on your own.
The Euclidean distance d between two vectors X and Y is:
d = sum((x-y).^2).^0.5
Tha above is taken from the docmunetation. You can read it and make a function on your own.

Community Treasure Hunt

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

Start Hunting!