How do i link the first and second push button to the third one so that button don't have to pick the other 2 image again and just export the last image
조회 수: 1 (최근 30일)
이전 댓글 표시
function varargout = untitled1(varargin)
% UNTITLED1 MATLAB code for untitled1.fig
% UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
% singleton*.
%
% H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
% the existing singleton*.
%
% UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED1.M with the given input arguments.
%
% UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled1_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled1_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 untitled1
% Last Modified by GUIDE v2.5 11-Feb-2019 14:39:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled1_OpeningFcn, ...
'gui_OutputFcn', @untitled1_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 untitled1 is made visible.
function untitled1_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 untitled1 (see VARARGIN)
% Choose default command line output for untitled1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled1_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;
% --- Executes on button press in pushbutton1.
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)
[filename1,pathname1]=uigetfile('*.*','Chon anh goc');
oimg=imread(num2str(fullfile(pathname1,filename1)));
[a b]=size(oimg);
axes(handles.axes1);
imshow(oimg);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename2,pathname2]=uigetfile('*.*','Chon thuy van');
WM=imread(num2str(fullfile(pathname2,filename2)));
if ndims(WM)
WM=rgb2gray(WM);
end
WM=imresize(WM,[512,512]);
axes(handles.axes2);
imshow(WM);
% --- Executes on button press in pushbutton3.
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)
[filename1,pathname1]=uigetfile('*.*','Chon anh goc');
oimg=imread(num2str(fullfile(pathname1,filename1)));
[a b]=size(oimg);
if ndims(oimg)
disp(a);
b=b/3;
disp(b);
oimg=imresize(oimg,[512,512]);
R=oimg(:,:,1);
G=oimg(:,:,2);
B=oimg(:,:,3);
else
R=imresize(oimg,[512,512]);
end
R=double(R);
[A,H,V,D]=dwt2(R,'haar');
f=A;
[filename2,pathname2]=uigetfile('*.*','Chon thuy van');
WM=imread(num2str(fullfile(pathname2,filename2)));
if ndims(WM)
WM=rgb2gray(WM);
end
WM=imresize(WM,[512,512]);
WM=imresize(WM,[256,256]);
WB=double(WM);
c=0.01;
F= f + (c.*abs(f).*WB);
[p q]=size(f);
for i=1:p
for j=1:q
ncA(i,j)=F(i,j);
end
end
if ndims(oimg)
Rimg=idwt2(ncA,V,H,D,'haar');
Wimg(:,:,1)=Rimg;
Wimg(:,:,2)=G;
Wimg(:,:,3)=B;
else
Wimg=idwt2(ncA,V,H,D,'haar');
end
Wimg=imresize(Wimg,[a b]);
[filename3,pathname3]=uiputfile('*.jpg');
imwrite(uint8(Wimg),fullfile(pathname3,filename3));
b=imread(fullfile(pathname3,filename3));
axes(handles.axes3);
imshow(b);
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!