Info

This question is closed. Reopen it to edit or answer.

How to sent two images as parameters from gui to main function using push button.Following is the code,we have tried.In the code,pushbutton3(load3) is the one through which we pass the images a parameters to maincod suggest appropriate modifications.

1 view (last 30 days)
function varargout = Pagui(varargin) global path1 path2 % PAGUI M-file for Pagui.fig % PAGUI, by itself, creates a new PAGUI or raises the existing % singleton*. % % H = PAGUI returns the handle to a new PAGUI or the handle to % the existing singleton*. % % PAGUI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in PAGUI.M with the given input arguments. % % PAGUI('Property','Value',...) creates a new PAGUI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before Pagui_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to Pagui_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 Pagui
% Last Modified by GUIDE v2.5 02-Apr-2014 09:43:04
% Begin initialization code - DO NOT EDIT gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Pagui_OpeningFcn, ... 'gui_OutputFcn', @Pagui_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 Pagui is made visible. function Pagui_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 Pagui (see VARARGIN)
% Choose default command line output for Pagui handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes Pagui wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = Pagui_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; ah = axes('unit', 'normalized', 'position', [0 0 1 1]); % import the background image and show it on the axes bg = imread('images\im4.jpg'); imagesc(bg); % prevent plotting over the background and turn the axis off set(ah,'handlevisibility','off','visible','off') % making sure the background is behind all the other uicontrols uistack(ah, 'bottom');
% Update handles structure guidata(hObject, handles);
% --- Executes on button press in Load1. function Load1_Callback(hObject, eventdata, handles) % hObject handle to Load1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im [path1,user_cance]=imgetfile(); if user_cance() msgbox(sprintf('Error'),'Error','Error'); return end im=imread(path1); %im=im2double(im); % conversion to double %im2=im; % for back up axes(handles.axes1); imshow(im);
% --- Executes on button press in Load2. function Load2_Callback(hObject, eventdata, handles) % hObject handle to Load2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global im [path2,user_cance]=imgetfile(); if user_cance() msgbox(sprintf('Error'),'Error','Error'); return end im=imread(path2); %im=im2double(im); % conversion to double %im2=im; % for back up axes(handles.axes2); imshow(im);
% --- Executes on button press in Load3. function Load3_Callback(hObject, eventdata, handles) % hObject handle to Load3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
l=imread(path1);
m=imread(path2);
d=coloreg2(l,m);
imshow(d);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!