currency recognition using image Processing Techniques in matlab
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
KSSV
2022-1-27
To have the function dist you need to have nnet toolbox. Do you have it? Try
which dist
回答(2 个)
Walter Roberson
2022-1-27
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 个评论
KSSV
2022-1-27
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!
