function varargout = carcheck(varargin)
% CARCHECK M-file for carcheck.fig
% CARCHECK, by itself, creates a new CARCHECK or raises the existing
% singleton*.
%
% H = CARCHECK returns the handle to a new CARCHECK or the handle to
% the existing singleton*.
%
% CARCHECK('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CARCHECK.M with the given input arguments.
%
% CARCHECK('Property','Value',...) creates a new CARCHECK or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before carcheck_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to carcheck_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help carcheck
% Last Modified by GUIDE v2.5 31-May-2007 19:22:10
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @carcheck_OpeningFcn, ...
'gui_OutputFcn', @carcheck_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 carcheck is made visible.
function carcheck_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 carcheck (see VARARGIN)
% Choose default command line output for carcheck
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes carcheck wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = carcheck_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;
% --- 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)
%选择打开指定图像
pnum=get(handles.listbox1,'value');
switch pnum
case 1
streetcar=imread('streetcar1.jpg');
case 2
streetcar=imread('streetcar2.jpg');
case 3
streetcar=imread('streetcar3.jpg');
otherwise
end
axes(handles.axes1);%选择坐标轴1
imshow(streetcar);%显示待识别图像
% --- 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)
pnum=get(handles.listbox1,'value');
switch pnum
case 1
streetcar=imread('streetcar1.jpg');
case 2
streetcar=imread('streetcar2.jpg');
case 3
streetcar=imread('streetcar3.jpg');
otherwise
end
%---------streetcar=rgb2gray(streetcar);
c=streetcar;
%imshow(c);
b=imread('street.jpg');
%---------b=rgb2gray(b);
%figure;
%imshow(b);
%c=imsubtract(a,b);
%将待识别图像与背景图像进行比较,识别出车子,并只留下车子
for i=1:600
for j=1:800
if (abs(double(b(i,j,1))-double(streetcar(i,j,1)))>2)
c(i,j,1)=0;
c(i,j,2)=0;
c(i,j,3)=0;
elseif (abs(double(b(i,j,2))-double(streetcar(i,j,2)))>2)
c(i,j,1)=0;
c(i,j,2)=0;
c(i,j,3)=0;
elseif (abs(double(b(i,j,3))-double(streetcar(i,j,3)))>2)
c(i,j,1)=0;
c(i,j,2)=0;
c(i,j,3)=0;
else
c(i,j,1)=255;
c(i,j,2)=255;
c(i,j,3)=255;
end
end
end
%图像处理,包括灰度化,二值化和腐蚀,去除噪声
%c=imcomplement(c)
%c=immultiply(a,c);
c=rgb2gray(c);
leftcar=dither(c);
%figure;
%imshow(leftcar);
leftcar=~leftcar;
%figure;
%imshow(leftcar);
leftcar=bwmorph(leftcar,'erode',1);
leftcar=~leftcar;
%leftcar=bwmorph(leftcar,'erode',5);
leftcar=~leftcar;
vsumleftcar=sum(leftcar,2);
%找到车棚,并得到宽度
for i=1:599
if (vsumleftcar(i)<80) & (vsumleftcar(i+1)>80)
top=i;
break;
end
end
for i=1:599
if (vsumleftcar(600-i)<80) & (vsumleftcar(599-i)>80)
bottom=600-i;
break;
end
end
topvalue=vsumleftcar(bottom-ceil((bottom-top)*4/5));
bottomvalue=vsumleftcar(bottom-ceil((bottom-top)*2/5));
maxvalue=max(vsumleftcar);
percent=topvalue/maxvalue;
axes(handles.axes2);
imshow(~leftcar);
h=findobj(gcf,'Tag','text2');
%根据判断依据确定车型
if (percent>=0.2) & (percent<=0.5)
set(h,'String','小型车');
elseif (percent>0.5) & (percent<=0.8)
set(h,'String','中型车');
elseif percent>0.8
set(h,'String','大型车');
end
% --- 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: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end

IT狂飙
- 粉丝: 4849
- 资源: 2649
最新资源
- 《灵活、有效、快速的交叉视步态识别网络》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- 《使用 Point Light Animation 分析和识别红外步态序列》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- 《使用深度 CNN 对人体进行距离识别》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- 《通过WiFi信号的信道状态信息(CSI)进行步态特征提取,进而实现用户识别》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- 《使用智能手机加速度计进行步态识别》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- 《使用预训练模型进行步态识别和人体姿势估计的深度神经网络结构》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- 《在野外使用智能手机进行基于深度学习的步态识别》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- 《一个灵活且可扩展的步态识别框架。可以专注于设计自己的模型并与最先进的模型轻松进行比较。》(毕业设计,源码,教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip
- VIENNA整流器仿真模型:零序注入SVPWM调制方式下中点点位平衡,电网电压电流同相位,THD含量优化至低于5%,Vienna整流器仿真模型:零序注入SVPWM调制方式下的中点点位平衡及电网电压电流
- 单相PWM整流Simulink仿真:高功率因数,低纹波输出,电流总谐波失真<5%,开关频率达20kHz ,单相PWM整流Simulink仿真:高效能参数优化设计 输入电压220V有效值,输出电压50
- DeepSeek从入门到精通(103页 PPT).pptx
- 风光水火储多能互补协调优化调度策略:降低负荷峰谷差,提升可再生能源消纳与火电机组经济性能,风光水火储多能互补系统的分层协调优化调度策略实现,计及调峰主动性的风光水火储多能系统互补协调优化调度 摘要:代
- DeepSeek大模型分享与展望.pptx
- MATLAB在湍流模拟中绘制Zernike相位屏的研究与应用,MATLAB算法在Zernike湍流相位屏可视化中的应用,MATLAB绘制Zernike湍流相位屏 ,MATLAB; Zernike湍流相
- 基于S7-1200 PLC控制的自动锅炉加热系统设计与仿真:全程温控及循环加热水处理工程实践,基于S7-1200 PLC的智能自动锅炉加热系统设计与仿真:从底部至顶部的温度控制与水循环过程,基于S7
- 用于手语识别的基于步态能量图像的系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


