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

📄 iprocessing.m

📁 这是一个关于简单matlab motino trakcing 算法的工具箱,十分清楚,请用winzip 解压缩
💻 M
📖 第 1 页 / 共 5 页
字号:
function varargout = IProcessing(varargin)%IPROCESSING M-file for IProcessing.fig%      IPROCESSING, by itself, creates a new IPROCESSING or raises the existing%      singleton*.%%      H = IPROCESSING returns the handle to a new IPROCESSING or the handle to%      the existing singleton*.%%      IPROCESSING('Property','Value',...) creates a new IPROCESSING using the%      given property value pairs. Unrecognized properties are passed via%      varargin to IProcessing_OpeningFcn.  This calling syntax produces a%      warning when there is an existing singleton*.%%      IPROCESSING('CALLBACK') and IPROCESSING('CALLBACK',hObject,...) call the%      local function named CALLBACK in IPROCESSING.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 IProcessing% Last Modified by GUIDE v2.5 20-Jun-2005 11:32:22% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...    'gui_Singleton',  gui_Singleton, ...    'gui_OpeningFcn', @IProcessing_OpeningFcn, ...    'gui_OutputFcn',  @IProcessing_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 IProcessing is made visible.function IProcessing_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)clc;% Choose default command line output for IProcessinghandles.output = hObject;handles.gray = 0;  %on-off grayscale imagehandles.lg = 1;    %Grayscale image Slider Lower limit valuehandles.hg = 255;  %Grayscale image Slider upper limit valuehandles.glbx = 1;  %Global X-Coordinate of the Markerhandles.glby = 1;  %Global Y-Coordinate of the Markerhandles.mx = 0;     %Marker Box x-coordinatehandles.my = 0;     %Marker Box y-coordinatehandles.pop = 1;   %Popup menu itemhandles.s2 = 0;  %Lower_in of image adjuster sliderhandles.s3 = 1;    %Upper_in of image adjuster sliderhandles.s4 = 0;    %Lower_out of image adjuster sliderhandles.s5 = 1;    %Upper_out of image adjuster sliderhandles.first = 0; %checks if it is the first time that user open a file.set(handles.slider2,'Value',handles.s2);set(handles.slider3,'Value',handles.s3);set(handles.slider4,'Value',handles.s4);set(handles.slider5,'Value',handles.s5);handles.rl = 1;     %Red Lower limit valuehandles.rh = 255;   %Red Upper limit valuehandles.gl = 1;     %Green Lower limit valuehandles.gh = 255;   %Green Upper limit valuehandles.bl = 1;     %Blue Lower limit valuehandles.bh = 255;   %Blue Upper limit valuehandles.marker = 0; %Marker Numberhandles.st = 1;handles.en = 1;handles.path = 1;  % Number of traced path to be shownhandles.Centroid_Flag = true;handles.manual_check_flag = true;set(handles.Centroid,'Value',handles.Centroid_Flag);set(handles.manual_check,'Value',handles.manual_check_flag);%set(handles.manual_check_value,'Visible',handles.manual_check_flag);set(handles.red_high,'Value',1);set(handles.green_high,'Value',1);set(handles.blue_high,'Value',1);set(handles.gray_high,'Value',1);handles.Originx = 1;handles.Originy = 1;handles.Scalex = 100;handles.Scaley = 100;handles.Scalefx = 1;handles.Scalefy = 1;% Update handles structureguidata(hObject, handles);% UIWAIT makes IProcessing wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = IProcessing_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 slider movement.function slider2_Callback(hObject, eventdata, handles)% hObject    handle to slider2 (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,'Value') returns position of slider%        get(hObject,'Min') and get(hObject,'Max') to determine range of sliderhandles.s2 = get(handles.slider2,'Value')guidata(hObject, handles);imageupdate(hObject,handles)% --- Executes during object creation, after setting all properties.function slider2_CreateFcn(hObject, eventdata, handles)% hObject    handle to slider2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor',[.9 .9 .9]);end% --- Executes on slider movement.function slider3_Callback(hObject, eventdata, handles)% hObject    handle to slider3 (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,'Value') returns position of slider%        get(hObject,'Min') and get(hObject,'Max') to determine range of sliderhandles.s3 = get(handles.slider3,'Value')guidata(hObject, handles);imageupdate(hObject,handles)% --- Executes during object creation, after setting all properties.function slider3_CreateFcn(hObject, eventdata, handles)% hObject    handle to slider3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor',[.9 .9 .9]);end% --- Executes on slider movement.function slider4_Callback(hObject, eventdata, handles)% hObject    handle to slider4 (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,'Value') returns position of slider%        get(hObject,'Min') and get(hObject,'Max') to determine range of sliderhandles.s4 = get(handles.slider4,'Value')guidata(hObject, handles);imageupdate(hObject,handles)% --- Executes during object creation, after setting all properties.function slider4_CreateFcn(hObject, eventdata, handles)% hObject    handle to slider4 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor',[.9 .9 .9]);end% --- Executes on slider movement.function slider5_Callback(hObject, eventdata, handles)% hObject    handle to slider5 (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,'Value') returns position of slider%        get(hObject,'Min') and get(hObject,'Max') to determine range of sliderhandles.s5 = get(handles.slider5,'Value')guidata(hObject, handles);imageupdate(hObject,handles)% --- Executes during object creation, after setting all properties.function slider5_CreateFcn(hObject, eventdata, handles)% hObject    handle to slider5 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor',[.9 .9 .9]);end% --- Executes on slider movement.function slider6_Callback(hObject, eventdata, handles)% hObject    handle to slider6 (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,'Value') returns position of slider%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider% --- Executes during object creation, after setting all properties.function slider6_CreateFcn(hObject, eventdata, handles)% hObject    handle to slider6 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor',[.9 .9 .9]);endfunction Frame_NO_Callback(hObject, eventdata, handles)% hObject    handle to Frame_NO (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 Frame_NO as text%        str2double(get(hObject,'String')) returns contents of Frame_NO as a doublehandles.n = round(str2double(get(handles.Frame_NO,'String')));if handles.n>max(size(handles.mov))    handles.n = max(size(handles.mov))    set(handles.Frame_NO,'String',handles.n);endset(handles.slider1,'Value',handles.n/max(size(handles.mov)));[I,Map] = frame2im(handles.mov(1,handles.n));if handles.gray==1; I=rgb2gray(I); end%axes(handles.axes1);%hold on,imshow(I)guidata(hObject, handles);imageupdate(hObject,handles);% --- Executes during object creation, after setting all properties.function Frame_NO_CreateFcn(hObject, eventdata, handles)% hObject    handle to Frame_NO (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 slider movement.function slider1_Callback(hObject, eventdata, handles)% hObject    handle to slider1 (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,'Value') returns position of slider%        get(hObject,'Min') and get(hObject,'Max') to determine range of slidersv = get(handles.slider1,'Value');handles.n=round(sv*max(size(handles.mov)));if handles.n ==0, handles.n=1;endset(handles.Frame_NO,'String',handles.n);guidata(hObject, handles);imageupdate(hObject,handles);% --- Executes during object creation, after setting all properties.function slider1_CreateFcn(hObject, eventdata, handles)% hObject    handle to slider1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: slider controls usually have a light gray background.if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))    set(hObject,'BackgroundColor',[.9 .9 .9]);end% --- Executes on button press in Start_Process.function Start_Process_Callback(hObject, eventdata, handles)packhandles.glbx(1:handles.nof) = NaN;handles.glby(1:handles.nof) = NaN;tolx = round((handles.w2-handles.w)/2);toly = round((handles.h2-handles.h)/2);yu = toly;yd = toly;xl = tolx;xr = tolx;vel = 0;velflag = false;ist = 0.4;   %Image Intensity Adjustmenthandles.x = handles.mx;handles.y = handles.my;%handles.pop = get(handles.popupmenu2,'Value');%pop=handles.pop;

⌨️ 快捷键说明

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