A list,

RMB serial number identification based on MATLAB GUI

Ii. Source code

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 %% Turn off the axis display [filename, pathname]=uigetfile({'*.jpg'; '*.bmp'; '*.gif'; '*.png'}, 'Select picture'); % % has no image contentif filename ==0
     return;
 end
im1 = imread ([pathname, filename]);
imwrite(im1,'C:\Users\lenovo\Desktop\www.dssz.com _ba30784c0af0816644cbf1722cf2 \ Matlab practice \ 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)% Rotate 90 degrees to the left A1=imread('C:\Users\lenovo\Desktop\www.dssz.com _ba30784c0af0816644cbf1722cf2 \ Matlab practice \ 0. JPG');
J1=imrotate(A1,90.'bicubic'.'loose'); % Set rotation Angle to achieve left (counterclockwise) rotation imwrite(J1,'C:\Users\lenovo\Desktop\www.dssz.com _ba30784c0af0816644cbf1722cf2 \ Matlab practice \ 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)% Rotate A2 to the right=imread('C:\Users\lenovo\Desktop\www.dssz.com _ba30784c0af0816644cbf1722cf2 \ Matlab practice \ 0. JPG');
J2=imrotate(A2,- 90..'bicubic'.'loose'); % Set rotation Angle to achieve left (counterclockwise) rotation imwrite(J2,'C:\Users\lenovo\Desktop\www.dssz.com _ba30784c0af0816644cbf1722cf2 \ Matlab practice \ 0. JPG');
axes(handles.axes4); 
imshow(J2); 
function OCR1(a)

warning off %#ok<WNOFF>
addpath('C:\Users\lenovo\Desktop\www.dssz.com _ba30784c0af0816644cbf1722cf2 \ Matlab practice \')

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

    imagen=imread('C:\Users\lenovo\Desktop\www.dssz.com _ba30784c0af0816644cbf1722cf2 \ Matlab practice \ 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 practice \';
    
    winopen('text1.txt');
    
Copy the code

3. Operation results





Fourth, note

Version: 2014a complete code or write plus 1564658423