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

📄 iprocessing.m

📁 这是一个关于简单matlab motino trakcing 算法的工具箱,十分清楚,请用winzip 解压缩
💻 M
📖 第 1 页 / 共 5 页
字号:
    guidata(hObject, handles);    for i=1:handles.marker        ss = T(1,2*i+1);        handles.name(i,1:max(size(ss))) = ss;        handles.posx(i,:) = round((N(6:end,2*i+1)*(handles.Scalex-handles.Originx)/handles.Scalefx)+handles.Originx);        handles.posy(i,:) = round((N(6:end,2*i+2)*(handles.Scaley-handles.Originy)/handles.Scalefy)+handles.Originy);        handles.posx(i,abs(handles.posx(i,:))>65535)=NaN;        handles.posy(i,abs(handles.posy(i,:))>65535)=NaN;    end    hg = handles.posx;    hg    size(hg)    handles.path = 2;    set(handles.All_markers,'Value',1)    guidata(hObject, handles);    imageupdate(hObject,handles);end% --------------------------------------------------------------------function Save_as_menu_Callback(hObject, eventdata, handles)% hObject    handle to Save_as_menu (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)[filename, pathname] = uiputfile('*.xls', 'Save As...');if isequal(filename,0) | isequal(pathname,0)    disp('User selected Cancel')else    file = fullfile(pathname,filename);    disp(['User selected: ',file])    % open an Excel Server.    e = actxserver('excel.application');    % Insert a new workbook.    eWorkbook = e.Workbooks.Add;    e.Visible = 0;    % Make the first sheet active.    eSheets = e.ActiveWorkbook.Sheets;    eSheet1 = eSheets.get('Item', 1);    eSheet1.Activate;    %     eActivesheetRange = e.Activesheet.get('Range', 'A1:A1');    %     eActivesheetRange.Value = 'Origin X';    %     eActivesheetRange = e.Activesheet.get('Range', 'B1:B1');    %     eActivesheetRange.Value = 'Origin Y';    %     eActivesheetRange = e.Activesheet.get('Range', 'C1:C1');    %     eActivesheetRange.Value = 'Scale X';    %     eActivesheetRange = e.Activesheet.get('Range', 'D1:D1');    %     eActivesheetRange.Value = 'Scale Y';    %     eActivesheetRange = e.Activesheet.get('Range', 'E1:E1');    %     eActivesheetRange.Value = 'Scale FX';    %     eActivesheetRange = e.Activesheet.get('Range', 'F1:F1');    %     eActivesheetRange.Value = 'Scale FY';    eActivesheetRange = e.Activesheet.get('Range', 'A1:A1');    eActivesheetRange.Value = handles.Originx;    eActivesheetRange = e.Activesheet.get('Range', 'B1:B1');    eActivesheetRange.Value = handles.Originy;    eActivesheetRange = e.Activesheet.get('Range', 'A2:A2');    eActivesheetRange.Value = handles.Scalex;    eActivesheetRange = e.Activesheet.get('Range', 'B2:B2');    eActivesheetRange.Value = handles.Scaley;    eActivesheetRange = e.Activesheet.get('Range', 'A3:A3');    eActivesheetRange.Value = handles.Scalefx;    eActivesheetRange = e.Activesheet.get('Range', 'B3:B3');    eActivesheetRange.Value = handles.Scalefy;    % Put a MATLAB array into Excel.    eActivesheetRange = e.Activesheet.get('Range', 'A5:A5');    eActivesheetRange.Value = 'Frame No';    eActivesheetRange = e.Activesheet.get('Range', 'B5:B5');    eActivesheetRange.Value = 'Time';    nof = [1:handles.nof]';    s = ['A6:A',num2str(handles.nof+5)];    eActivesheetRange = e.Activesheet.get('Range', s);    eActivesheetRange.Value = nof;    handles.marker    for i = 1:handles.marker        s = [char(66+2*i-1),'4:',char(66+2*i-1),'4'];        eActivesheetRange = e.Activesheet.get('Range', s);        eActivesheetRange.Value = handles.name(i,:);        s = [char(66+2*i-1),'5:',char(66+2*i-1),'5'];        eActivesheetRange = e.Activesheet.get('Range', s);        eActivesheetRange.Value = 'X';        s = [char(66+2*i),'5:',char(66+2*i),'5'];        eActivesheetRange = e.Activesheet.get('Range', s);        eActivesheetRange.Value = 'Y';        clear a;        a=((handles.posx(i,:)-handles.Originx)*handles.Scalefx/(handles.Scalex-handles.Originx))';        %s = [char(66+2*i-1),num2str(5+handles.posi(i)),':',char(66+2*i-1),num2str(handles.posi(i)+max(size(a))+5)]        s = [char(66+2*i-1),num2str(6),':',char(66+2*i-1),num2str(handles.nof)]        eActivesheetRange = e.Activesheet.get('Range', s);        eActivesheetRange.Value = round(1000*a)/1000;        clear a;        a=((handles.posy(i,:)-handles.Originy)*handles.Scalefy/(handles.Scaley-handles.Originy))';        %a=handles.posy(i,:)';        %    s = [char(66+2*i),num2str(5+handles.posi(i)),':',char(66+2*i),num2str(handles.posi(i)+max(size(a))+5)]        s = [char(66+2*i),num2str(6),':',char(66+2*i),num2str(handles.nof)];        eActivesheetRange = e.Activesheet.get('Range', s);        eActivesheetRange.Value = round(1000*a)/1000;    end    % Get back a range.  It will be a cell array, since the cell range    % can contain different types of data.    %    eRange = e.Activesheet.get('Range', 'A1:B2');    %    B = eRange.Value;    % Convert to a double matrix.  The cell array must contain only    % scalars.    %    B = reshape([B{:}], size(B));    % Now, save the workbook.    eWorkbook.SaveAs(file);    % To avoid saving the workbook and being prompted to do so,    % uncomment the following code.    eWorkbook.Saved = 1;    eWorkbook.Close;    % Quit Excel and delete the server.    e.Quit;    e.delete;end% --------------------------------------------------------------------function Save_jpeg_Callback(hObject, eventdata, handles)% hObject    handle to Save_jpeg (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)[filename, pathname] = uiputfile('*.jpg', 'Save As...');if isequal(filename,0) | isequal(pathname,0)    disp('User selected Cancel')else    [handles.I,Map] = frame2im(handles.mov(1,handles.n));    handles.I = imadjustment(handles);    imwrite(handles.I,filename,'jpg')    %guidata(hObject, handles);end% --------------------------------------------------------------------function exit_menu_Callback(hObject, eventdata, handles)% hObject    handle to exit_menu (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)close% --------------------------------------------------------------------function Help_menu_Callback(hObject, eventdata, handles)% hObject    handle to Help_menu (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function Help_contents_Callback(hObject, eventdata, handles)% hObject    handle to Help_contents (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)HelpPath = which('improc.html');web(HelpPath);% --------------------------------------------------------------------function about_Callback(hObject, eventdata, handles)% hObject    handle to about (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)str = sprintf(['Human Motion Tracer - Image Processing 1.1.1\n\n',...    'Sharif University of Technology\n',...    'Mechanical Engineering Department\n\n',...    'Copyright 2004-2006 The Microjects, Inc.\n']);msgbox(str,'About the Human Motion Tracer','modal');% --- Executes on button press in last_marker.function last_marker_Callback(hObject, eventdata, handles)% hObject    handle to last_marker (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 last_markerhandles.path = 1;%get (handles.last_marker,'Value');guidata(hObject, handles);imageupdate(hObject,handles);% --- Executes on button press in All_markers.function All_markers_Callback(hObject, eventdata, handles)% hObject    handle to All_markers (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 All_markershandles.path = 2;%*get (handles.All_markers,'Value');guidata(hObject, handles);imageupdate(hObject,handles);% --------------------------------------------------------------------function Markers_path_Callback(hObject, eventdata, handles)% hObject    handle to Markers_path (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)[handles.I,Map] = frame2im(handles.mov(1,handles.n));guidata(hObject, handles);handles.I = imadjustment(handles);figure,imshow(handles.I);hold onif handles.path == 1    plot(handles.glbx(handles.st:handles.en),handles.glby(handles.st:handles.en),'color','g')    plot(handles.glbx(handles.n),handles.glby(handles.n),'o')endif handles.path == 2    for i = 1:handles.marker        clear px;        clear px;        px=handles.posx(i,:)';        py=handles.posy(i,:)';        pxm=handles.posx(i,handles.n)';        pym=handles.posy(i,handles.n)';        hold on        plot(px,py,'color','g')        plot(pxm,pym,'o')    endendguidata(hObject, handles);% --- Executes on button press in Centroid.function Centroid_Callback(hObject, eventdata, handles)% hObject    handle to Centroid (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 Centroidhandles.Centroid_Flag = get(handles.Centroid,'Value');guidata(hObject, handles);% --- Executes on button press in manual_check.function manual_check_Callback(hObject, eventdata, handles)% hObject    handle to manual_check (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 manual_checkhandles.manual_check_flag = get(handles.manual_check,'Value');if handles.manual_check_flag    set(handles.manual_check_value,'Visible','on');else    set(handles.manual_check_value,'Visible','off');endguidata(hObject, handles);function manual_check_value_Callback(hObject, eventdata, handles)% hObject    handle to manual_check_value (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 manual_check_value as text%        str2double(get(hObject,'String')) returns contents of manual_check_value as a double% --- Executes during object creation, after setting all properties.function manual_check_value_CreateFcn(hObject, eventdata, handles)% hObject    handle to manual_check_value (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 Origin.function Origin_Callback(hObject, eventdata, handles)% hObject    handle to Origin (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)[x,y] = ginput(1);handles.Originx = round(x);handles.Originy = round(y);hold on;plot(x,y,'o','color','g')guidata(hObject, handles);% --- Executes on button press in X_Scale.function X_Scale_Callback(hObject, eventdata, handles)% hObject    handle to X_Scale (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)[x,y] = ginput(1);handles.Scalex = round(x);hold on;plot(x,handles.Originy,'o','color','g')defaultanswer={num2str(1)};en=inputdlg('Enter The Scale Factor of your selected X-Axis','Input',1,defaultanswer);handles.Scalefx = eval(char(en));guidata(hObject, handles);% --- Executes on button press in Y_Scale.function Y_Scale_Callback(hObject, eventdata, handles)% hObject    handle to Y_Scale (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)[x,y] = ginput(1);handles.Scaley = round(y);hold on;plot(handles.Originx,y,'o','color','g')defaultanswer={num2str(1)};en=inputdlg('Enter The Scale Factor of your selected Y-Axis','Input',1,defaultanswer);handles.Scalefy = eval(char(en));guidata(hObject, handles);

⌨️ 快捷键说明

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