diff options
-rw-r--r-- | gui_win.m | 44 |
1 files changed, 13 insertions, 31 deletions
@@ -63,12 +63,12 @@ handles.output = hObject; % Update handles structure guidata(hObject, handles); + % Set color of the strart button to green set(handles.button2start,'BackgroundColor','Green'); % Declare global variables global background_m; -global image_name; global isworking; global image_display; global image_original; @@ -82,7 +82,6 @@ image_display = 0; image_original = 0; image_cleaned = 0; image_fitted = 0; -image_name = 'test.png'; image_cross = 0; isworking = 0; @@ -109,17 +108,6 @@ varargout{1} = handles.output; -% This funcion just calls the external program which takes an image from camera -% We call it with parameters read from the GUI fields -function grabimage(handles) -global image_name; -global image_display; -global image_original; -run_string = horzcat('grabNimages_1394cam.exe -s ',num2str(get(handles.readshutterspeed,'String')),' -n ',num2str(get(handles.readnumber,'String'))); -[status,result] = system(run_string); -img=imread(image_name); -image_display=double(img); -image_original=image_display; @@ -149,6 +137,15 @@ drawnow; +function grab_image_and_update_display(handles) +global image_display; +global image_original; +shutter_time = num2str(get(handles.readshutterspeed,'String')); +Naverages = get(handles.readnumber,'String'); +image_original = grabimage(shutter_time, Naverages); +image_display = image_original; +display_stuff(handles); + % This function is executed when START button is pressed. @@ -176,29 +173,15 @@ set(handles.button2start,'BackgroundColor','Red'); set(handles.button2start,'String','STOP'); drawnow; % needed to draw this before doing fit - - - - % This is for the single run if get(handles.button2singlerun,'Value') - - % Grab an image from camera - grabimage(handles); - display_stuff(handles); - + grab_image_and_update_display(handles); end; - - - - -% This executes when we do the continious run -% Same as the single fit exept that we have a while cycle +% This executes when we do the continuous run if get(handles.button2comtinuousrun,'Value') while get(handles.button2start,'Value') > 0 - grabimage(handles); - display_stuff(handles); + grab_image_and_update_display(handles); end; end; @@ -491,7 +474,6 @@ function button2save_Callback(hObject, eventdata, handles) % hObject handle to button2save (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) -global image_name; global image_display; %fname_to_save = horzcat(pwd,filesep,'saved_images',filesep,datestr(now, 'yyyy_mm_dd_HHMMSS'),'.png'); fname_to_save = horzcat('Z:\beam_profiler images',filesep,datestr(now, 'yyyy_mm_dd_HHMMSS'),'.png'); |