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

조회 수: 3 (최근 30일)
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

채택된 답변

Walter Roberson
Walter Roberson 2019년 3월 28일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by