📄 iprocessing.m
字号:
% --- Executes on button press in move_right.function move_right_Callback(hObject, eventdata, handles)% hObject handle to move_right (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)imageupdate(hObject,handles)handles.mx = handles.mx + 1;handles.my = handles.my;axes(handles.axes1)tolx = round((handles.w2-handles.w)/2);toly = round((handles.h2-handles.h)/2);rectangle('Position',[handles.mx,handles.my,handles.w,handles.h],'Curvature',[0.2,0.2],'EdgeColor','g')rectangle('Position',[handles.mx-tolx,handles.my-toly,handles.w2,handles.h2],'Curvature',[0.2,0.2],'EdgeColor','r')guidata(hObject, handles);% --- Executes on button press in move_down.function move_down_Callback(hObject, eventdata, handles)% hObject handle to move_down (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)imageupdate(hObject,handles)handles.mx = handles.mx;handles.my = handles.my + 1;axes(handles.axes1)tolx = round((handles.w2-handles.w)/2);toly = round((handles.h2-handles.h)/2);rectangle('Position',[handles.mx,handles.my,handles.w,handles.h],'Curvature',[0.2,0.2],'EdgeColor','g')rectangle('Position',[handles.mx-tolx,handles.my-toly,handles.w2,handles.h2],'Curvature',[0.2,0.2],'EdgeColor','r')guidata(hObject, handles);% --- Executes on button press in move_left.function move_left_Callback(hObject, eventdata, handles)% hObject handle to move_left (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)imageupdate(hObject,handles)handles.mx = handles.mx - 1;handles.my = handles.my;axes(handles.axes1)tolx = round((handles.w2-handles.w)/2);toly = round((handles.h2-handles.h)/2);rectangle('Position',[handles.mx,handles.my,handles.w,handles.h],'Curvature',[0.2,0.2],'EdgeColor','g')rectangle('Position',[handles.mx-tolx,handles.my-toly,handles.w2,handles.h2],'Curvature',[0.2,0.2],'EdgeColor','r')guidata(hObject, handles);function Marker_Height_Callback(hObject, eventdata, handles)% hObject handle to Marker_Height (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 Marker_Height as text% str2double(get(hObject,'String')) returns contents of Marker_Height as a double% --- Executes during object creation, after setting all properties.function Marker_Height_CreateFcn(hObject, eventdata, handles)% hObject handle to Marker_Height (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 Marker_Width_Callback(hObject, eventdata, handles)% hObject handle to Marker_Width (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 Marker_Width as text% str2double(get(hObject,'String')) returns contents of Marker_Width as a double% --- Executes during object creation, after setting all properties.function Marker_Width_CreateFcn(hObject, eventdata, handles)% hObject handle to Marker_Width (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 selection change in popupmenu2.function popupmenu2_Callback(hObject, eventdata, handles)% hObject handle to popupmenu2 (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 popupmenu2 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu2% --- Executes during object creation, after setting all properties.function popupmenu2_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu2 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');end% --- Executes on button press in Database.function Database_Callback(hObject, eventdata, handles)% hObject handle to Database (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)if handles.marker==0 warndlg('To Continue First Enter The Marker Name');else prompt={'From frame #:','To frame #:'}; name='Range of frames to save'; numlines=1; defaultanswer={num2str(handles.st),num2str(handles.en)}; answer=inputdlg(prompt,name,numlines,defaultanswer); st = eval(char(answer(1))); en = eval(char(answer(2))); handles.posx(handles.marker,st:en) = handles.glbx(1,st:en); handles.posy(handles.marker,st:en)= handles.glby(1,st:en); guidata(hObject, handles);endimageupdate(hObject,handles);% --- Executes on button press in Marker_name.function Marker_name_Callback(hObject, eventdata, handles)% hObject handle to Marker_name (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)handles.marker = handles.marker+1;prompt={'Enter a title for the new marker'};name='Marker Title';numlines=1;s = ['Marker_No_' , num2str(handles.marker)];defaultanswer={s};name=inputdlg(prompt,name,numlines,defaultanswer);if size(name) handles.name(handles.marker,1:max(size(name))) = name; handles.posx(handles.marker,1:handles.nof) = NaN; handles.posy(handles.marker,1:handles.nof) = NaN; handles.glbx(1:handles.nof) = NaN; handles.glby(1:handles.nof) = NaN; guidata(hObject, handles);endfunction Marker_Height2_Callback(hObject, eventdata, handles)% hObject handle to Marker_Height2 (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 Marker_Height2 as text% str2double(get(hObject,'String')) returns contents of Marker_Height2 as a double% --- Executes during object creation, after setting all properties.function Marker_Height2_CreateFcn(hObject, eventdata, handles)% hObject handle to Marker_Height2 (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 Marker_width2_Callback(hObject, eventdata, handles)% hObject handle to Marker_width2 (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 Marker_width2 as text% str2double(get(hObject,'String')) returns contents of Marker_width2 as a double% --- Executes during object creation, after setting all properties.function Marker_width2_CreateFcn(hObject, eventdata, handles)% hObject handle to Marker_width2 (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 Marker_Width2_Callback(hObject, eventdata, handles)% hObject handle to Marker_Width2 (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 Marker_Width2 as text% str2double(get(hObject,'String')) returns contents of Marker_Width2 as a double% --- Executes during object creation, after setting all properties.function Marker_Width2_CreateFcn(hObject, eventdata, handles)% hObject handle to Marker_Width2 (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% --------------------------------------------------------------------function File_menu_Callback(hObject, eventdata, handles)% hObject handle to File_menu (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function load_workspace_Callback(hObject, eventdata, handles)% hObject handle to load_workspace (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)disp(' please wait ... ');disp(' Loading data from Workspace ... ');handles.mov = [];handles.glbx = [];handles.glby = [];handles.glbx = 1; %Global X-Coordinate of the Markerhandles.glby = 1; %Global Y-Coordinate of the Markerhandles.mov = evalin('base','F');handles.nof = max(size(handles.mov));handles.n = handles.nof;set(handles.slider1,'Value',1);set(handles.Frame_NO,'String',handles.n);[handles.I,Map] = frame2im(handles.mov(1,handles.n));disp(' Loading Process completed ');[handles.I,Map] = frame2im(handles.mov(1,handles.n));guidata(hObject, handles);handles.I = imadjustment(handles);set(handles.slider1,'SliderStep',[1/handles.nof;.1])axes(handles.axes1)clahold on,imshow(handles.I);% if handles.first == 0% handles.hp = impixelinfo;% set(handles.hp,'Position',[150 280 300 20]);% handles.first = 1;% endguidata(hObject, handles);% --------------------------------------------------------------------function Open_menu_Callback(hObject, eventdata, handles)% hObject handle to Open_menu (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)clc;[filename, pathname] = uigetfile('*.avi', 'Pick an avi-file');if isequal(filename,0) disp('User selected Cancel')else file = fullfile(pathname, filename) disp(['User selected', file]) name = ['Iprocessing - ' file]; set(IProcessing,'Name',name) pack handles.I = []; handles.mov = []; handles.glbx = []; handles.glby = []; handles.glbx = 1; %Global X-Coordinate of the Marker handles.glby = 1; %Global Y-Coordinate of the Marker handles.mov = aviread(file); handles.nof = max(size(handles.mov)); handles.n = handles.nof; set(handles.slider1,'Value',1); set(handles.Frame_NO,'String',handles.n); [handles.I,Map] = frame2im(handles.mov(1,handles.n)); guidata(hObject, handles); handles.I = imadjustment(handles); axes(handles.axes1) cla hold on,imshow(handles.I); set(handles.slider1,'SliderStep',[1/handles.nof;.1]) handles.glbx(1:handles.nof) = NaN; handles.glby(1:handles.nof) = NaN; guidata(hObject, handles);end% --------------------------------------------------------------------function Open_excel_Callback(hObject, eventdata, handles)% hObject handle to Open_excel (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)clc;[filename, pathname] = uigetfile('*.xls', 'Pick an xls-file');if isequal(filename,0) disp('User selected Cancel')else file = fullfile(pathname, filename) disp(['User selected', file]) [N T] = xlsread(file); Nsz = size(N); handles.marker = (Nsz(2)-2)/2; handles.posy = []; handles.posx = []; %handles.name = {}; handles.Originx = N(1,1); handles.Originy = N(1,2); handles.Scalex = N(2,1); handles.Scaley = N(2,2); handles.Scalefx = N(3,1); handles.Scalefy = N(3,2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -