I am working on Imdian currency recognition and developed the code for same but some errors are troubling me. Please check.

3 views (last 30 days)
clear all;
close all;
clc;
vid=videoinput('winvideo',1,'YUY2_320x240');
set(vid,'FramesPerTrigger',Inf);
set(vid,'returnedColorspace','rgb');
vid.FrameGrabInterval=5;
start(vid);
while(vid.FramesAcquired<=10)
data=getsnapshot(vid);
% image(data)
end
stop(vid);
image(data);
h = imrect;
pos = getPosition(h);
strip11=imcrop(data,pos);
figure;
imshow(strip11);
%imwrite(strip11,'k2000.jpg');
im1=imread('note2000.jpg');
im1=imresize(im1,[200,600]);
%[m,n,l]=size(im1);
figure;
subplot(2,2,1);
imshow(im1);
a=kavi_feature(im1);
%im2=imread('note500.jpg');
im=imresize(strip11,[200,600]);
%[m,n,l]=size(im1);
figure;subplot(2,2,1);imshow(im);
b=kavi_feature(im);
d=dist(a,b');
if(d<40743.1616752612)
disp('note is same')
else
disp('note is different');
end
function final_out = kavi_feature(im)
[m,n,l]=size(im);
a=double(im)/255;
R=a(:,:,1);
G=a(:,:,2);
B=a(:,:,3);
num=(1/2)*((R-G)+(R-B));
denom=((R-G).^2+((R-B).*(G-B))).^0.5;
H=acos(num./denom);
H(B>G)=360-H(B>G);
H=H./360;
%subplot(2,2,2);imshow(h);
S=1-(3.*min(a,[],3));
%subplot(2,2,3);imshow(s);
I=(R+G+B)/3.255;
%subplot(2,2,4);imshow(i);
HSI(1:m,1:n,1:l)=0;
HSI(:,:,1)=H(:,:);
HSI(:,:,2)=S(:,:);
HSI(:,:,3)=I(:,:);
h=HSI(:,:,1);
s=HSI(:,:,2);
i=HSI(:,:,3);
subplot(2,2,2);h3=imhist(h);
subplot(2,2,3);imhist(s);
subplot(2,2,4);imhist(i);
y=mean(a(:));
y1 = var(a(:));
y2 = std(a(:)) ;
A=[h3' y y1 y2];
C1 = colorAutoCorrelogram(im);
h1 = hsvHistogram(im);
w = waveletTransform(im);
final_out=[A,C1,h1,w];
End

Accepted Answer

Walter Roberson
Walter Roberson on 28 Mar 2019

More Answers (0)

Categories

Find more on Data Import and Analysis 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!