Can you help me with this GUI code?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Below is my GUI code;
function varargout = GUI(varargin) % GUI MATLAB code for GUI.fig % GUI, by itself, creates a new GUI or raises the existing % singleton*. % % H = GUI returns the handle to a new GUI or the handle to % the existing singleton*. % % GUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in GUI.M with the given input arguments. % % GUI('Property','Value',...) creates a new GUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before GUI_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to GUI_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
% Edit the above text to modify the response to help GUI
% Last Modified by GUIDE v2.5 13-May-2014 11:06:13
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @GUI_OpeningFcn, ... 'gui_OutputFcn', @GUI_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 GUI is made visible. function GUI_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 GUI (see VARARGIN)
% Choose default command line output for GUI handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes GUI wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = GUI_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; A = imread ('track.jpg'); axes(handles.axes3); imshow(A);
% --- Executes on button press in pushbutton6.import video function pushbutton6_Callback(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [nm,pth]=uigetfile({'*.avi'},'Load Matlab File'); mmObj=mmreader([pth,nm]); handles.pth=pth; handles.nm=nm; handles.Video=mmObj; image1=read(mmObj,1); axes(handles.axes1); imshow(image1); guidata(hObject,handles); data=guidata(hObject);
% --- Executes on button press in pushbutton7. Play/pause function pushbutton7_Callback(hObject, eventdata, handles) % hObject handle to pushbutton7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Variable = getappdata(handles.axes1 , 'avifile') %movie(handles.axes1,[nm,pth]);
% --- Executes on button press in pushbutton5. select finish line function pushbutton5_Callback(hObject, eventdata, handles) %[nm,pth]=uigetfile({' % hObject handle to pushbutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %figure(5) %imshow();%show image finish line [x,y]=ginput(1) %x=data(1){:,1} %y=data(1){:,2} %print (x,y)
% --- Executes on button press in pushbutton1. finish frame 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) ct=1; % counter t=0; %start time = 0 tinc=1/1000; % camera frame rate w=10; st=510; for I=1:5; I; %mov01=aviread(fname,I); %dframe=getfield(mov01(:,1),'cdata'); %pic1(:,:)=double(dframe); % get image n b=I*(w+1); a=b-w; fline(:,a:b)=image1(:,st:st+w); end
imagesc(fline.^0.5); colormap('gray')
% --- Executes on button press in pushbutton3.print frame function pushbutton3_Callback(hObject, eventdata, handles) % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)\\\\\ %print (image1)
I am having trouble as i need to refer to the avi file which is loaded into the GUI to play it and produce a still image from it however no variables are created for it in the workspace so how do I refer to it or import the avi file back to the workspace so i can refer to it?
Also i need to refer to the points chose when digitised however the points only appear in the command window and do not show in the workspace, what code would I need to write to save the x,y coordinates as a variable which I can use for my calculation to produce the still image.
Thanks
0 Commenti
Risposte (1)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!