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

📄 show2.m

📁 粒子滤波全套源代码
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = show2(varargin)global x;global y;global himage;global first;%SHOW2 M-file for show2.fig%      SHOW2, by itself, creates a new SHOW2 or raises the existing%      singleton*.%%      H = SHOW2 returns the handle to a new SHOW2 or the handle to%      the existing singleton*.%%      SHOW2('Property','Value',...) creates a new SHOW2 using the%      given property value pairs. Unrecognized properties are passed via%      varargin to show2_OpeningFcn.  This calling syntax produces a%      warning when there is an existing singleton*.%%      SHOW2('CALLBACK') and SHOW2('CALLBACK',hObject,...) call the%      local function named CALLBACK in SHOW2.M with the given input%      arguments.%%      *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 show2% Last Modified by GUIDE v2.5 27-Mar-2007 10:50:31% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @show2_OpeningFcn, ...                   'gui_OutputFcn',  @show2_OutputFcn, ...                   'gui_LayoutFcn',  [], ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})   gui_State.gui_Callback = str2func(varargin{1});endif 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 show2 is made visible.function show2_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   unrecognized PropertyName/PropertyValue pairs from the%            command line (see VARARGIN)global first;global particleNum;global frameNum;global particleWidth;global particleHigh;global weigthError;% Choose default command line output for show2handles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes show2 wait for user response (see UIRESUME)% uiwait(handles.figure1);%my addaxes(handles.axes1);axis([0 726 0 578]);%initialparticleNum=500;frameNum=10;particleWidth=10;particleHigh=10;weigthError=0.20;set(handles.particleNum,'String',num2str(particleNum));set(handles.frameNum,'String',num2str(frameNum));set(handles.particleWidth,'String',num2str(particleWidth));set(handles.particleHigh,'String',num2str(particleHigh));set(handles.weigthError,'String',num2str(weigthError));%% --- Outputs from this function are returned to the command line.function varargout = show2_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 structurevarargout{1} = handles.output;% --- Executes on mouse press over axes background.function axes1_ButtonDownFcn(hObject, eventdata, handles)% hObject    handle to axes1 (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);% axis([0 726 0 578]);% point=get(hObject,'CurrentPoint');% x=point(1,1);% y=point(1,2);% cenx=x-5;% ceny=y-5;% rectangle('Position',[cenx,ceny,10,10],'FaceColor','r');% x1=num2str(x);% y1=num2str(y);% pp=['x=',x1,'/','y=',y1];% msgbox(pp,'Information','non-modal');%axes(handles.axes1);%rectangle('Position',[x,y,0.1,0.1],'FaceColor','r');%x=int16(point(1,1)*726)%y=int16(point(1,2)*578)%axes(handles.axes1);%rectangle('Position',[0.05,0.05,0.01,0.01],'FaceColor','r');%window=get(hObject.axes1,'Position');% --- 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)global first;global pathname;global filenamelength;global bFirst;bFirst=0;[filename, pathname]=uigetfile('*.JPG', 'Pick an JPG-file');axes(handles.axes1);himage=imshow([pathname '\' filename]);[value name] = strread(filename, '%d.%s')first=value;filenamelength=length(filename);filenamelength=filenamelength-4;% handle= guihandles;set(handles.InitPicInfo,'String',[pathname '\' filename]);% axes(handles.axes1);% axis([0 726 0 578]);% rectangle('Position',[x,y,50,50],'FaceColor','r');% --- Executes on mouse press over figure background, over a disabled or% --- inactive control, or over an axes background.function figure1_WindowButtonDownFcn(hObject, eventdata, handles)% hObject    handle to figure1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)global x;global y;global himage;axes(handles.axes1);% axis([0 726 0 578]);point=get(handles.axes1,'CurrentPoint');cenx=point(1,1);ceny=point(1,2);cenx=int16(cenx);ceny=int16(ceny);x=cenx-3;y=ceny-3;rectangle('Position',[x,y,6,6],'FaceColor','r');set(handles.x1,'String',['     X:    ' num2str(x)]);set(handles.y1,'String',['    Y:    ' num2str(y)]);% --- 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)global x;global y;global first;global particleNum;global frameNum;global particleWidth;global particleHigh;global weigthError;hx=20;hy=20;N=500;n=2;new_sita=0.20;Estimate=tracker(x,y,particleWidth,particleHigh,particleNum,first,frameNum,weigthError);function particleNum_Callback(hObject, eventdata, handles)% hObject    handle to particleNum (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 particleNum as text%        str2double(get(hObject,'String')) returns contents of particleNum as a doubleglobal particleNum;particleNum=str2num(get(hObject,'String'));% --- Executes during object creation, after setting all properties.function particleNum_CreateFcn(hObject, eventdata, handles)% hObject    handle to particleNum (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');endfunction frameNum_Callback(hObject, eventdata, handles)% hObject    handle to frameNum (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 frameNum as text%        str2double(get(hObject,'String')) returns contents of frameNum as a doubleglobal frameNum;frameNum=str2num(get(hObject,'String'));% --- Executes during object creation, after setting all properties.function frameNum_CreateFcn(hObject, eventdata, handles)% hObject    handle to frameNum (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');endfunction weigth_Callback(hObject, eventdata, handles)% hObject    handle to weigth (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 weigth as text%        str2double(get(hObject,'String')) returns contents of weigth as a doubleglobal weigthError;weigthError=str2double(get(hObject,'String'));% --- Executes during object creation, after setting all properties.function weigth_CreateFcn(hObject, eventdata, handles)% hObject    handle to weigth (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');endfunction 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 doubleglobal particleWidth;particleWidth=str2num(get(hObject,'String'));% --- 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');endfunction particleHigh_Callback(hObject, eventdata, handles)

⌨️ 快捷键说明

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