currency recognition using image Processing Techniques in matlab

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 个评论

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
i downloaded Deep learning toolbox and its working now . Thanks.

请先登录,再进行评论。

回答(2 个)

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.
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.

类别

帮助中心File Exchange 中查找有关 Downloads 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by