⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gskmadechar.m

📁 基于人工神经网络的手写英文字母、数字图像识别的源程序代码。
💻 M
📖 第 1 页 / 共 2 页
字号:
intv009 = intv000;
intv010 = intv001;
for intv003 = 1:intv000
    intv007 = 0;
    for intv004 = 1:intv001
        if (un8v000(intv003,intv004,1) ~= 255) || (un8v000(intv003,intv004,2) ~= 255) || (un8v000(intv003,intv004,3) ~= 255)
            intv007 = intv007 + 1;
            if intv007 == 1
                intv009 = min(intv003,intv009);
                intv010 = min(intv004,intv010);
            end
            intv005 = max(intv005,intv003);
            intv006 = max(intv006,intv004);
        end
    end
end
if ((intv005 == intv009) || (intv006 == intv010)) || (intv005 == 0) || (intv006 == 0) || (intv009 == 0) || (intv010 == 0)
    msgbox([{'Image cannot have less than 2 lines (line must be longer than 2 pixels)',char(13),'Teaching is not sucessful'}],'ChrRecg - GSK');
else
    if (intv005 - intv009) > (intv006 - intv010)
        intv003 = 9 / (intv005 - intv009);
    else
        intv003 = 9 / (intv006 - intv010);
    end
    axes(handles.axes1);
%    figure
    cla
    hold on
    for intv011 = 1 : intv000
        for intv012 = 1 : intv001
            if (un8v000(intv011,intv012,1) ~= 255) || (un8v000(intv011,intv012,2) ~= 255) || (un8v000(intv011,intv012,3) ~= 255)
                intv013 = round(intv003 * (intv011 -intv009)) + 1;
                intv014 = round(intv003 * (intv012 -intv010)) + 1;
                inmv000((intv013-1) * 10 + intv014,1) = 1;
                plot(intv014,-intv013);
            end
        end
    end
    xlim([0 11]);
    ylim([-11 0]);
    hold off
    [intv000,intv001] = size(incmv000);
    if intv000>0
        logv000 = 0;
        for intv002 = 1 : intv000
            if inmv000(1:100,1) == incmv000(intv002,1:100)'
                logv000 = 1;
                if ~isempty(chrv001)
                    intv004 = unicode2native(chrv001);
                    iolmv000(intv002,1)= intv004(1,1);
                    logv001 = 1;
                end
            end
        end
    end
    if (intv000 == 0) | (logv000 == 0)
        incmv000(intv000+1,1:100) = inmv000;
        intv004 = unicode2native(chrv001);
        iolmv000(intv000+1,1) = intv004(1,1);
        wtmv000 = wtmv000 + (inmv000 * inmv000');
%        for intv011 = 1:100
%            wtmv000(intv011,intv011) = 0;
%        end
    end
end


% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
chrv000 = [{'CHARACTER RECOGNITION WITH NEURAL ANALYSIS'}...
    {''}...
    {}...
    {'This programme used simple algorithm of auto assosiative principle of artificial neural networks analysis with asynchronous updation. Algorithm used here is very simple and robust one.'}...
    {''}...
    {''}...
    {'Number of iterations required depend on the mach between input given to the available teaching data. Number of iteration may exceen with improper teaching. We allow you to specify time limit of each processing so that incase of long iteration the processing will stop to reduce the problem of hanging.'}...
    {''}...
    {''}...
    {'First we need to train the system by typing alphabet or numaric in textbox provided.'}...
    {''}...
    {'Paintbrush will open where we can draw input image, use "Air Brush" tool in paintbrush for good results'}...
    {''}...
    {'Same alphabet can be taught more than once (It is recomended to teach each alphabet more than 10 times'}...
    {''}...
    {'You can save the systems learned data for future use or for future updation. It is similar to stoping work now and continuing afterwards. Load / Save buttons should be used for this purpose'}...
    {''}...
    {'By pressing the button start, you are allowed to enter the image which will approximated to nearest alphabet of numaric'}...
    {''}...
    {'Please send your suggetions to "gadisureshkumar@gmail.com"'}...
    {''}...
    {''}...
    {'Prepared by Suresh Kumar Gadi'}];
msgbox(chrv000,'ChrRecg - GSK');
    
    
    
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)




% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

chrv000 = questdlg([{'This will delete present learned data!!!'};{'Are You Sure ???'}],'Question ?','Yes','No.','No.','Yes');
if chrv000 == 'Yes'
    clear global
    global inmv000 wtmv000 incmv000 iolmv000

    inmv000 = zeros(100,1);
    inmv000 = (-1) + inmv000;
    incmv000 = zeros(1,100);
    incmv000 = (-1) + incmv000;
    iolmv000 = 45;
    wtmv000 = zeros(100,100);
    wtmv000 = wtmv000 + (inmv000 * inmv000');
%    for intv011 = 1:100
%        wtmv000(intv011,intv011) = 0;
%    end
else
    msgbox([{'Cancelled by user',char(13),'Learned data clearing is not sucessful'}],'ChrRecg - GSK');
end



function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global inmv000 wtmv000 incmv000 iolmv000
intv000 = wtmv000 / max(abs(max(abs(wtmv000))));
figure
hold on
grid off
for intv001 = 1:100
    for intv002 = 1:100
        if intv000(intv001,intv002) < 0
            plot(intv001,100-intv002,'--rs','LineWidth',1,'MarkerEdgeColor','b','MarkerFaceColor',[-1*intv000(intv001,intv002) 0 0],'MarkerSize',10);
        else
            if intv000(intv001,intv002) > 0
                plot(intv001,100-intv002,'--rs','LineWidth',1,'MarkerEdgeColor','b','MarkerFaceColor',[0 intv000(intv001,intv002) 0],'MarkerSize',10);
            else
                plot(intv001,100-intv002,'--rs','LineWidth',1,'MarkerEdgeColor','b','MarkerFaceColor',[1 1 0],'MarkerSize',10);
            end
        end
    end
end
hold off
        
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton15 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global inmv000 wtmv000 incmv000 iolmv000
[intv000, intv001] = size(incmv000);
figure
hold on
for intv002 = 1:intv000
    for intv003 = 1:100
        if incmv000(intv002,intv003) > 0
            plot(intv003,intv002,'--rs','LineWidth',1,'MarkerEdgeColor','b','MarkerFaceColor',[0 1 0],'MarkerSize',10);
        else
            plot(intv003,intv002,'--rs','LineWidth',1,'MarkerEdgeColor','b','MarkerFaceColor',[1 0 0],'MarkerSize',10);
        end
    end
end
hold off        
%msgbox([{'Recorded input patterens are displyed on mainwindow of MATLAB'}],'ChrRecg - GSK');


% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton16 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global inmv000 wtmv000 incmv000 iolmv000
char(iolmv000)
msgbox([{'Recorded Ouputs are displyed on mainwindow of MATLAB'}],'ChrRecg - GSK');





function edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox1




% --- Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton17 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

global inmv000 wtmv000 incmv000 iolmv000
figure
hold on
for intv000 = 1:100
    if inmv000(intv000,1) > 0
        plot(intv000,1,'--rs','LineWidth',1,'MarkerEdgeColor','b','MarkerFaceColor',[0 1 0],'MarkerSize',10);
    else
        plot(intv000,1,'--rs','LineWidth',1,'MarkerEdgeColor','b','MarkerFaceColor',[1 0 0],'MarkerSize',10);
    end
end
hold off
%msgbox([{'Present input matrix is displyed on mainwindow of MATLAB'}],'ChrRecg - GSK');


% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox1


% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton1


% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject    handle to radiobutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of radiobutton2




% --- Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox2


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -