Fake Currency detection project

16 views (last 30 days)
Mohd
Mohd on 13 Apr 2023
Edited: DGM on 17 Apr 2023
Unrecognized function or variable 'A'.
Error in fake2 (line 76)
for n=1 :size(A,1) % i GET THE ERROR IN THIS LINE A IS 'ROI-Extract Texture & Statistical Features
i am attaching my project file... could anyone help me to resolve the error in my code?
Actually I am strugling from long time to remove the error but I couldn't figureout the solution. please help.

Accepted Answer

Image Analyst
Image Analyst on 13 Apr 2023
Your Avg is 157, hence none of the if statements gets entered and none of your mat files get loaded.
Avg=mean2(Igray);
if(Avg>202 && Avg < 207)
load 100.mat
elseif(Avg > 175 && Avg<180)
load 200.mat
elseif(Avg>190 && Avg<195)
load '500.mat'
elseif(Avg>209 && Avg<214)
load '2000.mat'
end
I presume (the poorly-named) "A" is in one of those mat files, like we said in your duplicate post. The code and algorithm are really fragile otherwise, but at least you can alert yourself to the problem by changing it to:
Avg=mean2(Igray);
if(Avg>202 && Avg < 207)
load 100.mat
elseif(Avg > 175 && Avg<180)
load 200.mat
elseif(Avg>190 && Avg<195)
load '500.mat'
elseif(Avg>209 && Avg<214)
load '2000.mat'
else
% Avg was not in any of those ranges.
errorMessage = sprintf('Error! Avg = %f\nso none of your MAT files got loaded!', Avg);
uiwait(errordlg(errorMessage))
return;
end
  3 Comments
Image Analyst
Image Analyst on 17 Apr 2023
What was the Avg for the case where it popped up the error? Like 208 or 174 or 214.1 or something? What mat file do you want to use in that case?
DGM
DGM on 17 Apr 2023
Edited: DGM on 17 Apr 2023
I wouldn't expect the average gray value of an arbitrarily-cropped uncalibrated image to be a reliable indicator of the object properties (specifically the denomination of the bill). For the Gandhi new series rupee notes, you could probably get better results if you classify based on color information instead of gray level. That presumes that all your notes come from the same series though.

Sign in to comment.

More Answers (0)

Categories

Find more on Biomedical Imaging in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!