function varargout = main(varargin)
% MAIN MATLAB code for main.fig
% MAIN, by itself, creates a new MAIN or raises the existing
% singleton*.
%
% H = MAIN returns the handle to a new MAIN or the handle to
% the existing singleton*.
%
% MAIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MAIN.M with the given input arguments.
%
% MAIN('Property','Value',...) creates a new MAIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before main_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to main_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help main
% Last Modified by GUIDE v2.5 31-May-2016 17:38:07
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @main_OpeningFcn, ...
'gui_OutputFcn', @main_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
% End initialization code - DO NOT EDIT
% --- Executes just before main is made visible.
function main_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to main (see VARARGIN)
% Choose default command line output for main
handles.output = hObject;
clc; warning off all;
axes(handles.axes1); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes2); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes3); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes4); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes5); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes6); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes7); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes8); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes9); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes10); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes11); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes12); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes13); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes14); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes15); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
set(handles.edit1, 'string', []);
handles.Img=[];
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes main wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = main_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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 pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes2); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes3); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes4); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes5); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes6); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes7); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes8); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes9); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes10); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes11); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes12); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes13); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes14); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
axes(handles.axes15); cla reset; box on; set(gca, 'XTickLabel', [], 'YTickLabel', []);
set(handles.edit1, 'string', []);
set(handles.edit2, 'string', []);
[filename, pathname] = uigetfile({'*.jpg;*.tif;*.png;*.gif', 'All Image Files';...
'*.*', '所有文件' }, '选择图像文件', fullfile(pwd, 'images/川F1A666.jpg'));
if filename == 0
return;
end
% 文件名
file = fullfile(pathname, filename);
% 图像矩阵
Img = imread(file);
%激活第一个轴对象
axes(handles.axes1);
imshow(Img, []);
%激活第二个轴对象
axes(handles.axes2);
imshow(Img, []);
%保存为全局变量
handles.Img = Img;
guidata(hObject, handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Img=handles.Img;
%对图像I进行灰度处理
I_gray=rgb2gray(Img);
axes(handles.axes3);
imshow(I_gray);
title('灰度图像');
%利用Sobel算子进行边缘检测
I_edge=edge(I_gray,'sobel');
axes(handles.axes4);
imshow(I_edge)
title('边缘检测后图像');
se=[1;1;1];
%对边缘图像进行腐蚀
I_erode=imerode(I_edge,se);
axes(handles.axes5);
imshow(I_erode);
title('腐蚀后边缘图像');
se=strel('rectangle',[25,25]);
%填充图像
I_close=imclose(I_erode,se);
axes(handles.axes6);
imshow(I_close)
title('填充后图像');
%去除聚团灰度值小于1500的部分
I_final=bwareaopen(I_close,1500);
axes(handles.axes7);
imshow(I_final);
title('形态滤波后图像');
I_new=zeros(size(I_final,1),size(I_final,2));
location_of_1=[];
%寻找二值图像中
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
MATLAB实现基于阈值分割的车牌定位识别【计算机视觉、深度学习实战】.zip (168个子文件)
I.bmp 2KB
1.bmp 2KB
冀.bmp 2KB
豫.bmp 2KB
蒙.bmp 2KB
S.bmp 2KB
P.bmp 2KB
鲁.bmp 2KB
6.bmp 2KB
陕.bmp 2KB
8.bmp 2KB
L.bmp 2KB
7.bmp 2KB
T.bmp 2KB
U.bmp 2KB
0.bmp 2KB
苏.bmp 2KB
沪.bmp 2KB
K.bmp 2KB
赣.bmp 2KB
粤.bmp 2KB
桂.bmp 2KB
M.bmp 2KB
Y.bmp 2KB
X.bmp 2KB
宁.bmp 2KB
4.bmp 2KB
川.bmp 2KB
W.bmp 2KB
C.bmp 2KB
皖.bmp 2KB
Q.bmp 2KB
3.bmp 2KB
A.bmp 2KB
9.bmp 2KB
鄂.bmp 2KB
D.bmp 2KB
5.bmp 2KB
吉.bmp 2KB
J.bmp 2KB
F.bmp 2KB
G.bmp 2KB
黑.bmp 2KB
辽.bmp 2KB
京.bmp 2KB
津.bmp 2KB
R.bmp 2KB
闽.bmp 2KB
H.bmp 2KB
N.bmp 2KB
E.bmp 2KB
O.bmp 2KB
V.bmp 2KB
Z.bmp 2KB
B.bmp 2KB
2.bmp 2KB
浙.bmp 2KB
湘.bmp 2KB
晋.bmp 2KB
main.fig 195KB
Gui_Main.fig 68KB
car.jpg 186KB
鲁AHC250.jpg 133KB
浙BD7D69.jpg 131KB
琼A5555B.jpg 126KB
京QM2Z68.jpg 113KB
京QJK255.jpg 99KB
黑EP2587.jpg 94KB
京NN87F8.jpg 94KB
鲁B58Q17.jpg 92KB
京QTK250.jpg 90KB
京GKB785.jpg 85KB
京NU9K26.jpg 84KB
冀TDD000.jpg 83KB
京NM8T88.jpg 81KB
苏BMW888.jpg 74KB
京PML810.jpg 66KB
粤DS8888.jpg 65KB
京N08Y8A.jpg 64KB
京GUH876.jpg 60KB
皖AVV190.jpg 56KB
闽CC2020.jpg 52KB
京QYJ357.jpg 50KB
京QY6742.jpg 50KB
京N820B3.jpg 47KB
辽A09030.jpg 47KB
京N4N414.jpg 41KB
云A526EG.jpg 39KB
鲁LC1336.jpg 38KB
湘M4AK47.jpg 38KB
吉BR1777.jpg 38KB
川F1A666.jpg 37KB
辽B5705D.jpg 37KB
苏E31R79.JPG 35KB
鲁JD9309.jpg 35KB
陕V10086.jpg 34KB
辽AJW767.jpg 33KB
豫AVN999.jpg 32KB
晋A8888A.jpg 32KB
鄂K9M555.jpg 29KB
共 168 条
- 1
- 2
资源评论
不脱发的程序猿
- 粉丝: 26w+
- 资源: 5872
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功