Java教程

【人民币识别】基于matlab GUI人民币序列号识别【含Matlab源码 908期】

本文主要是介绍【人民币识别】基于matlab GUI人民币序列号识别【含Matlab源码 908期】,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

一、简介

基于matlab GUI人民币序列号识别

二、源代码

function varargout = untitled1(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @untitled1_OpeningFcn, ...
                   'gui_OutputFcn',  @untitled1_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end

function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;

guidata(hObject, handles);


function varargout = untitled1_OutputFcn(hObject, eventdata, handles) 

varargout{1} = handles.output;



function pushbutton1_Callback(hObject, eventdata, handles)



function edit1_Callback(hObject, eventdata, handles)

function edit1_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit2_Callback(hObject, eventdata, handles)

function edit2_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function pushbutton2_Callback(hObject, eventdata, handles)


function pushbutton3_Callback(hObject, eventdata, handles)

axis off  %%关闭坐标轴显示
 [filename, pathname] =uigetfile({'*.jpg'; '*.bmp'; '*.gif'; '*.png'}, '选择图片');
% % 没有图像内容
 if filename ==0
     return;
 end
im1 = imread ([pathname, filename]);
imwrite(im1,'C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\0.jpg');

axes(handles.axes4); 
imshow(im1); 

  


function pushbutton4_Callback(hObject, eventdata, handles)



function uibuttongroup1_SizeChangedFcn(hObject, eventdata, handles)


function pushbutton5_Callback(hObject, eventdata, handles)


function pushbutton6_Callback(hObject, eventdata, handles)  %向左旋转90度

A1=imread('C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\0.jpg');
J1=imrotate(A1,90,'bicubic','loose');   %设置旋转角度,实现向左(逆时针)旋转
imwrite(J1,'C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\0.jpg');
axes(handles.axes4); 
imshow(J1); 

function pushbutton7_Callback(hObject, eventdata, handles)


function pushbutton8_Callback(hObject, eventdata, handles)


function uibuttongroup1_SelectionChangedFcn(hObject, eventdata, handles)


function pushbutton9_Callback(hObject, eventdata, handles) %向右旋转

A2=imread('C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\0.jpg');
J2=imrotate(A2,-90,'bicubic','loose');   %设置旋转角度,实现向左(逆时针)旋转
imwrite(J2,'C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\0.jpg');
axes(handles.axes4); 
imshow(J2); 
function OCR1()

warning off %#ok<WNOFF>
addpath('C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\')

if(exist('text1.txt','file')==2)
               delete('text1.txt')
end

    imagen=imread('C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\1.jpg');
    
     imshow(imagen);
     title('INPUT IMAGE WITH NOISE');
     pause(0.5);

    if size(imagen,3)==3 %RGB image
        imagen=rgb2gray(imagen);
    end
    
     threshold = graythresh(imagen);
     imagen =~im2bw(imagen,threshold);
    
    imagen = bwareaopen(imagen,30);
    
    word=[ ];
    re=imagen;
    
    fid = fopen('text1.txt', 'a');
   
    load templates
    global templates
   
    num_letras=size(templates,2);
    while 1
        
        [fl re]=lines(re);
        imgn=fl;
        
        [L Ne] = bwlabel(imgn);    
        for n=1:Ne
            [r,c] = find(L==n);
           
            n1=imgn(min(r):max(r),min(c):max(c));  
            
            img_r=imresize(n1,[42 24]);
            
            letter=read_letter(img_r,num_letras);
            
            word=[word letter];
        end
       
        fprintf(fid,'%s\n',word);
        
        word=[ ];
       
        if isempty(re) 
            break
        end    
    end
    fclose(fid);
    copyfile text1.txt 'C:\Users\lenovo\Desktop\www.dssz.com_ba30784c0af0816644cbf1722cf2\Matlab练习\';
    
    winopen('text1.txt');
    


三、运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、备注

版本:2014a
完整代码或代写加1564658423

这篇关于【人民币识别】基于matlab GUI人民币序列号识别【含Matlab源码 908期】的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!