GUIDE to App Designer
24 次查看(过去 30 天)
显示 更早的评论
I have migrate my GUIDE to app designer, then some of the button are having problems. I do hope someone can help me fixing this code.
classdef ImageProcessingTool_App_2_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
figure1 matlab.ui.Figure
text4 matlab.ui.control.Label
pushbutton20 matlab.ui.control.Button
pushbutton19 matlab.ui.control.Button
pushbutton18 matlab.ui.control.Button
pushbutton17 matlab.ui.control.Button
pushbutton16 matlab.ui.control.Button
pushbutton15 matlab.ui.control.Button
pushbutton14 matlab.ui.control.Button
pushbutton13 matlab.ui.control.Button
pushbutton12 matlab.ui.control.Button
pushbutton11 matlab.ui.control.Button
pushbutton10 matlab.ui.control.Button
pushbutton9 matlab.ui.control.Button
pushbutton8 matlab.ui.control.Button
pushbutton7 matlab.ui.control.Button
pushbutton6 matlab.ui.control.Button
pushbutton3 matlab.ui.control.Button
pushbutton2 matlab.ui.control.Button
pushbutton1 matlab.ui.control.Button
uipanel1 matlab.ui.container.Panel
pushbutton5 matlab.ui.control.Button
pushbutton4 matlab.ui.control.Button
uipanel2 matlab.ui.container.Panel
uipanel9 matlab.ui.container.Panel
text6 matlab.ui.control.Label
text5 matlab.ui.control.Label
axes7 matlab.ui.control.UIAxes
axes6 matlab.ui.control.UIAxes
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function ImageProcessingTool_OpeningFcn(app, varargin)
% --- Executes just before ImageProcessingTool is made visible.
% Ensure that the app appears on screen when run
movegui(app.figure1, 'onscreen');
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app); %#ok<ASGLU>
% 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 ImageProcessingTool (see VARARGIN)
% Choose default command line output for ImageProcessingTool
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
end
% Button pushed function: pushbutton10
function pushbutton10_Callback(app, event)
% --- Executes on button press in pushbutton10.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
green=a;
green(:,:,1)=0;
green(:,:,3)=0;
setappdata(0,'filename',green);
setappdata(0,'imrotation',green);
axes(handles.axes7);
imshow(green)
end
% Button pushed function: pushbutton11
function pushbutton11_Callback(app, event)
% --- Executes on button press in pushbutton11.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
blue=a;
blue(:,:,1)=0;
blue(:,:,2)=0;
setappdata(0,'filename',blue);
setappdata(0,'imrotation',blue);
axes(handles.axes7);
imshow(blue)
end
% Button pushed function: pushbutton12
function pushbutton12_Callback(app, event)
% --- Executes on button press in pushbutton12.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
rotate=imrotate(a,45);
axes(handles.axes7);
imshow(rotate);
end
% Button pushed function: pushbutton13
function pushbutton13_Callback(app, event)
% --- Executes on button press in pushbutton13.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
eq=histeq(a);
axes(handles.axes7);
imshow(eq)
end
% Button pushed function: pushbutton14
function pushbutton14_Callback(app, event)
% --- Executes on button press in pushbutton14.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton14 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
rz=imresize(a,0.1);
axes(handles.axes7);
imshow(rz)
end
% Button pushed function: pushbutton15
function pushbutton15_Callback(app, event)
% --- Executes on button press in pushbutton15.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
noise=imnoise(a,'salt & pepper');
axes(handles.axes7);
imshow(noise)
end
% Button pushed function: pushbutton16
function pushbutton16_Callback(app, event)
% --- Executes on button press in pushbutton16.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton16 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
noise=imnoise(a,'salt & pepper');
a3=fspecial('average',[7,7]);
t_sp_a3=filter2(a3,noise);
axes(handles.axes7);
imshow(t_sp_a3/255)
end
% Button pushed function: pushbutton17
function pushbutton17_Callback(app, event)
% --- Executes on button press in pushbutton17.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton17 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
noise=imnoise(a,'gaussian');
axes(handles.axes7);
imshow(noise)
end
% Button pushed function: pushbutton18
function pushbutton18_Callback(app, event)
% --- Executes on button press in pushbutton18.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton18 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I=getappdata(0,'a');
I=rgb2gray(I);
BW3=edge(I,'sobel');
axes(handles.axes7);
imshow(BW3);
end
% Button pushed function: pushbutton19
function pushbutton19_Callback(app, event)
% --- Executes on button press in pushbutton19.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton19 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I=getappdata(0,'a');
I=rgb2gray(I);
BW2=edge(I,'canny');
axes(handles.axes7);
imshow(BW2);
end
% Button pushed function: pushbutton1
function pushbutton1_Callback(app, event)
% --- Executes on button press in pushbutton1.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, app] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% 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)
a=uigetfile();
filename=a;
setappdata(0,'filename',filename);
a=imread(a);
axes(app.axes6);
imshow(a);
setappdata(0,'a',a)
setappdata(0,'filename',a);
plot(app.axes6,'a')
end
% Button pushed function: pushbutton20
function pushbutton20_Callback(app, event)
% --- Executes on button press in pushbutton20.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, app] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
i=getappdata(0,'a');
i2=flip(i,2);
axes(app.axes7);
imshow(i2)
end
% Button pushed function: pushbutton2
function pushbutton2_Callback(app, event)
% --- Executes on button press in pushbutton2.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% 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)
a=getappdata(0,'a');
a_bw=imbinarize(a,.57);
axes(app.axes7);
imshow(a_bw)
setappdata(0,'filename',a_bw);
end
% Button pushed function: pushbutton3
function pushbutton3_Callback(app, event)
% --- Executes on button press in pushbutton3.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% 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)
a=getappdata(0,'a');
a_gray=rgb2gray(a);
setappdata(0,'filename',a_gray);
axes(app.axes7);
imshow(a_gray)
end
% Button pushed function: pushbutton4
function pushbutton4_Callback(app, event)
% --- Executes on button press in pushbutton4.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
imshow(a);
end
% Button pushed function: pushbutton5
function pushbutton5_Callback(app, event)
% --- Executes on button press in pushbutton5.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% 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)
msgbox('Thanks for using image processing tool')
pause(1)
close();
close();
end
% Button pushed function: pushbutton6
function pushbutton6_Callback(app, event)
% --- Executes on button press in pushbutton6.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% 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)
a=getappdata(0,'a');
input=a;
input=rgb2gray(input);
axes(handles.axes7)
imhist(input)
end
% Button pushed function: pushbutton7
function pushbutton7_Callback(app, event)
% --- Executes on button press in pushbutton7.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% 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)
a=getappdata(0,'a');
input=a;
axes(handles.axes7);
imhist(input)
end
% Button pushed function: pushbutton8
function pushbutton8_Callback(app, event)
% --- Executes on button press in pushbutton8.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton8 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
IM2=imcomplement(a);
axes(handles.axes7);
imshow(IM2);
end
% Button pushed function: pushbutton9
function pushbutton9_Callback(app, event)
% --- Executes on button press in pushbutton9.
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app, event); %#ok<ASGLU>
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'a');
red=a;
red(:,:,2:3)=0;
setappdata(0,'filename',red);
setappdata(0,'imrotation',red);
axes(handles.axes7);
imshow(red)
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create figure1 and hide until all components are created
app.figure1 = uifigure('Visible', 'off');
app.figure1.Position = [680 491 1281 607];
app.figure1.Name = 'ImageProcessingTool';
app.figure1.Resize = 'off';
app.figure1.HandleVisibility = 'callback';
app.figure1.Tag = 'figure1';
% Create uipanel9
app.uipanel9 = uipanel(app.figure1);
app.uipanel9.BackgroundColor = [0.149019607843137 0.149019607843137 0.149019607843137];
app.uipanel9.Tag = 'uipanel9';
app.uipanel9.FontSize = 10.6666666666667;
app.uipanel9.Position = [50 28 1101 569];
% Create axes6
app.axes6 = uiaxes(app.uipanel9);
app.axes6.FontSize = 12.6666666666667;
app.axes6.NextPlot = 'replace';
app.axes6.Tag = 'axes6';
app.axes6.Position = [227 210 300 275];
% Create axes7
app.axes7 = uiaxes(app.uipanel9);
app.axes7.FontSize = 12.6666666666667;
app.axes7.NextPlot = 'replace';
app.axes7.Tag = 'axes7';
app.axes7.Position = [545 210 297 275];
% Create text5
app.text5 = uilabel(app.uipanel9);
app.text5.Tag = 'text5';
app.text5.BackgroundColor = [0.149019607843137 0.149019607843137 0.149019607843137];
app.text5.HorizontalAlignment = 'center';
app.text5.VerticalAlignment = 'top';
app.text5.WordWrap = 'on';
app.text5.FontSize = 16;
app.text5.FontColor = [0.901960784313726 0.901960784313726 0.901960784313726];
app.text5.Position = [310 479 151 20.9999999999999];
app.text5.Text = 'Original Image';
% Create text6
app.text6 = uilabel(app.uipanel9);
app.text6.Tag = 'text6';
app.text6.BackgroundColor = [0.149019607843137 0.149019607843137 0.149019607843137];
app.text6.HorizontalAlignment = 'center';
app.text6.VerticalAlignment = 'top';
app.text6.WordWrap = 'on';
app.text6.FontSize = 16;
app.text6.FontColor = [0.901960784313726 0.901960784313726 0.901960784313726];
app.text6.Position = [628 478 151 21];
app.text6.Text = 'Remodel Image';
% Create uipanel2
app.uipanel2 = uipanel(app.figure1);
app.uipanel2.Title = 'Advanced Options';
app.uipanel2.BackgroundColor = [0.650980392156863 0.650980392156863 0.650980392156863];
app.uipanel2.Tag = 'uipanel2';
app.uipanel2.FontSize = 10.6666666666667;
app.uipanel2.Position = [366 57 751 176];
% Create uipanel1
app.uipanel1 = uipanel(app.figure1);
app.uipanel1.Title = 'Basic Options';
app.uipanel1.BackgroundColor = [0.650980392156863 0.650980392156863 0.650980392156863];
app.uipanel1.Tag = 'uipanel1';
app.uipanel1.FontSize = 10.6666666666667;
app.uipanel1.Position = [89 57 257 176];
% Create pushbutton4
app.pushbutton4 = uibutton(app.uipanel1, 'push');
app.pushbutton4.ButtonPushedFcn = createCallbackFcn(app, @pushbutton4_Callback, true);
app.pushbutton4.Tag = 'pushbutton4';
app.pushbutton4.FontSize = 10.6666666666667;
app.pushbutton4.Position = [137 115 104 40];
app.pushbutton4.Text = 'Reset';
% Create pushbutton5
app.pushbutton5 = uibutton(app.uipanel1, 'push');
app.pushbutton5.ButtonPushedFcn = createCallbackFcn(app, @pushbutton5_Callback, true);
app.pushbutton5.Tag = 'pushbutton5';
app.pushbutton5.FontSize = 10.6666666666667;
app.pushbutton5.Position = [137 63 104 40];
app.pushbutton5.Text = 'Exit';
% Create pushbutton1
app.pushbutton1 = uibutton(app.figure1, 'push');
app.pushbutton1.ButtonPushedFcn = createCallbackFcn(app, @pushbutton1_Callback, true);
app.pushbutton1.Tag = 'pushbutton1';
app.pushbutton1.FontSize = 10.6666666666667;
app.pushbutton1.Position = [102 172 104 40];
app.pushbutton1.Text = 'Import';
% Create pushbutton2
app.pushbutton2 = uibutton(app.figure1, 'push');
app.pushbutton2.ButtonPushedFcn = createCallbackFcn(app, @pushbutton2_Callback, true);
app.pushbutton2.Tag = 'pushbutton2';
app.pushbutton2.FontSize = 10.6666666666667;
app.pushbutton2.Position = [102 122 104 40];
app.pushbutton2.Text = 'Binary';
% Create pushbutton3
app.pushbutton3 = uibutton(app.figure1, 'push');
app.pushbutton3.ButtonPushedFcn = createCallbackFcn(app, @pushbutton3_Callback, true);
app.pushbutton3.Tag = 'pushbutton3';
app.pushbutton3.FontSize = 10.6666666666667;
app.pushbutton3.Position = [102 73 104 40];
app.pushbutton3.Text = 'Grayscale';
% Create pushbutton6
app.pushbutton6 = uibutton(app.figure1, 'push');
app.pushbutton6.ButtonPushedFcn = createCallbackFcn(app, @pushbutton6_Callback, true);
app.pushbutton6.Tag = 'pushbutton6';
app.pushbutton6.FontSize = 10.6666666666667;
app.pushbutton6.Position = [382 172 104 40];
app.pushbutton6.Text = 'RGB Histogram';
% Create pushbutton7
app.pushbutton7 = uibutton(app.figure1, 'push');
app.pushbutton7.ButtonPushedFcn = createCallbackFcn(app, @pushbutton7_Callback, true);
app.pushbutton7.Tag = 'pushbutton7';
app.pushbutton7.FontSize = 10.6666666666667;
app.pushbutton7.Position = [382 123 104 40];
app.pushbutton7.Text = 'Gray Historgram';
% Create pushbutton8
app.pushbutton8 = uibutton(app.figure1, 'push');
app.pushbutton8.ButtonPushedFcn = createCallbackFcn(app, @pushbutton8_Callback, true);
app.pushbutton8.Tag = 'pushbutton8';
app.pushbutton8.FontSize = 10.6666666666667;
app.pushbutton8.Position = [383 72 104 40];
app.pushbutton8.Text = 'Complement';
% Create pushbutton9
app.pushbutton9 = uibutton(app.figure1, 'push');
app.pushbutton9.ButtonPushedFcn = createCallbackFcn(app, @pushbutton9_Callback, true);
app.pushbutton9.Tag = 'pushbutton9';
app.pushbutton9.FontSize = 10.6666666666667;
app.pushbutton9.Position = [535 173 104 40];
app.pushbutton9.Text = 'Red';
% Create pushbutton10
app.pushbutton10 = uibutton(app.figure1, 'push');
app.pushbutton10.ButtonPushedFcn = createCallbackFcn(app, @pushbutton10_Callback, true);
app.pushbutton10.Tag = 'pushbutton10';
app.pushbutton10.FontSize = 10.6666666666667;
app.pushbutton10.Position = [534 122 104 40];
app.pushbutton10.Text = 'Green';
% Create pushbutton11
app.pushbutton11 = uibutton(app.figure1, 'push');
app.pushbutton11.ButtonPushedFcn = createCallbackFcn(app, @pushbutton11_Callback, true);
app.pushbutton11.Tag = 'pushbutton11';
app.pushbutton11.FontSize = 10.6666666666667;
app.pushbutton11.Position = [535 73 104 40];
app.pushbutton11.Text = 'Blue';
% Create pushbutton12
app.pushbutton12 = uibutton(app.figure1, 'push');
app.pushbutton12.ButtonPushedFcn = createCallbackFcn(app, @pushbutton12_Callback, true);
app.pushbutton12.Tag = 'pushbutton12';
app.pushbutton12.FontSize = 10.6666666666667;
app.pushbutton12.Position = [688 173 104 40];
app.pushbutton12.Text = 'Rotate 45';
% Create pushbutton13
app.pushbutton13 = uibutton(app.figure1, 'push');
app.pushbutton13.ButtonPushedFcn = createCallbackFcn(app, @pushbutton13_Callback, true);
app.pushbutton13.Tag = 'pushbutton13';
app.pushbutton13.FontSize = 10.6666666666667;
app.pushbutton13.Position = [688 123 104 40];
app.pushbutton13.Text = 'Equlization';
% Create pushbutton14
app.pushbutton14 = uibutton(app.figure1, 'push');
app.pushbutton14.ButtonPushedFcn = createCallbackFcn(app, @pushbutton14_Callback, true);
app.pushbutton14.Tag = 'pushbutton14';
app.pushbutton14.FontSize = 10.6666666666667;
app.pushbutton14.Position = [689 73 104 40];
app.pushbutton14.Text = 'Resize';
% Create pushbutton15
app.pushbutton15 = uibutton(app.figure1, 'push');
app.pushbutton15.ButtonPushedFcn = createCallbackFcn(app, @pushbutton15_Callback, true);
app.pushbutton15.Tag = 'pushbutton15';
app.pushbutton15.FontSize = 10.6666666666667;
app.pushbutton15.Position = [835 173 104 40];
app.pushbutton15.Text = 'Salt & Pepper Noise';
% Create pushbutton16
app.pushbutton16 = uibutton(app.figure1, 'push');
app.pushbutton16.ButtonPushedFcn = createCallbackFcn(app, @pushbutton16_Callback, true);
app.pushbutton16.Tag = 'pushbutton16';
app.pushbutton16.FontSize = 10.6666666666667;
app.pushbutton16.Position = [836 123 104 40];
app.pushbutton16.Text = 'Low Pass Filter';
% Create pushbutton17
app.pushbutton17 = uibutton(app.figure1, 'push');
app.pushbutton17.ButtonPushedFcn = createCallbackFcn(app, @pushbutton17_Callback, true);
app.pushbutton17.Tag = 'pushbutton17';
app.pushbutton17.FontSize = 10.6666666666667;
app.pushbutton17.Position = [836 72 104 40];
app.pushbutton17.Text = 'Gaussian Noise';
% Create pushbutton18
app.pushbutton18 = uibutton(app.figure1, 'push');
app.pushbutton18.ButtonPushedFcn = createCallbackFcn(app, @pushbutton18_Callback, true);
app.pushbutton18.Tag = 'pushbutton18';
app.pushbutton18.FontSize = 10.6666666666667;
app.pushbutton18.Position = [983 173 122 40];
app.pushbutton18.Text = 'Edge Detection Sobel';
% Create pushbutton19
app.pushbutton19 = uibutton(app.figure1, 'push');
app.pushbutton19.ButtonPushedFcn = createCallbackFcn(app, @pushbutton19_Callback, true);
app.pushbutton19.Tag = 'pushbutton19';
app.pushbutton19.FontSize = 10.6666666666667;
app.pushbutton19.Position = [983 123 123 40];
app.pushbutton19.Text = 'Edge Detection Canny';
% Create pushbutton20
app.pushbutton20 = uibutton(app.figure1, 'push');
app.pushbutton20.ButtonPushedFcn = createCallbackFcn(app, @pushbutton20_Callback, true);
app.pushbutton20.Tag = 'pushbutton20';
app.pushbutton20.FontSize = 10.6666666666667;
app.pushbutton20.Position = [983 72 122 40];
app.pushbutton20.Text = 'Flip';
% Create text4
app.text4 = uilabel(app.figure1);
app.text4.Tag = 'text4';
app.text4.HorizontalAlignment = 'center';
app.text4.VerticalAlignment = 'top';
app.text4.WordWrap = 'on';
app.text4.FontSize = 26.6666666666667;
app.text4.Position = [377 547 454 36];
app.text4.Text = 'Image Processing Tools';
% Show the figure after all components are created
app.figure1.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = ImageProcessingTool_App_2_exported(varargin)
runningApp = getRunningApp(app);
% Check for running singleton app
if isempty(runningApp)
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.figure1)
% Execute the startup function
runStartupFcn(app, @(app)ImageProcessingTool_OpeningFcn(app, varargin{:}))
else
% Focus the running singleton app
figure(runningApp.figure1)
app = runningApp;
end
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.figure1)
end
end
end
Error using plot
Invalid data argument.
Error in ImageProcessingTool_App_2/pushbutton1_Callback (line 252)
plot(app.axes6,'a')
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Error using images.internal.imageDisplayValidateParams>validateCData
If input is logical (binary), it must be two-dimensional.
Error in images.internal.imageDisplayValidateParams (line 30)
common_args.CData = validateCData(common_args.CData,image_type);
Error in images.internal.imageDisplayParseInputs (line 79)
common_args = images.internal.imageDisplayValidateParams(common_args);
Error in imshow (line 253)
images.internal.imageDisplayParseInputs({'Parent','Border','Reduce'},preparsed_varargin{:});
Error in ImageProcessingTool_App_2/pushbutton2_Callback (line 284)
imshow(a_bw)
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.imhistc'.
Error in imhist (line 96)
y = images.internal.builtins.imhistc(a, n, isScaled, top); % Call MEX file to do work.
Error in ImageProcessingTool_App_2/pushbutton6_Callback (line 349)
imhist(input)
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.imhistc'.
Error in imhist (line 96)
y = images.internal.builtins.imhistc(a, n, isScaled, top); % Call MEX file to do work.
Error in ImageProcessingTool_App_2/pushbutton7_Callback (line 365)
imhist(input)
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.imlincombc'.
Error in imlincomb (line 75)
Z = images.internal.builtins.imlincombc(ims, scalars, outputClass);
Error in affine2d/transformPointsForward (line 175)
varargout{1} = imlincomb(M(1,1),u, M(2,1),v, M(3,1), class(self.T));
Error in affine2d/outputLimits (line 269)
[X,Y] = transformPointsForward(self,U,V);
Error in imrotate>getOutputBound (line 325)
[XWorldLimitsOut,YWorldLimitsOut] = outputLimits(tform,XWorldLimits,YWorldLimits);
Error in imrotate (line 143)
outputSize = getOutputBound(tform,twod_size,bbox);
Error in ImageProcessingTool_App_2/pushbutton12_Callback (line 113)
rotate=imrotate(a,45);
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.imhistc'.
Error in imhist (line 96)
y = images.internal.builtins.imhistc(a, n, isScaled, top); % Call MEX file to do work.
Error in histeq>computeCumulativeHistogram (line 232)
nn = imhist(img,nbins)';
Error in histeq (line 177)
[nn,cum] = computeCumulativeHistogram(a,NPTS);
Error in ImageProcessingTool_App_2/pushbutton13_Callback (line 129)
eq=histeq(a);
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.grayto8'.
Error in im2uint8 (line 66)
u = images.internal.builtins.grayto8(img);
Error in images.internal.changeClass (line 14)
image = im2uint8(varargin{:});
Error in images.internal.algimnoise (line 103)
b = images.internal.changeClass(classIn, b);
Error in imnoise (line 88)
b = images.internal.algimnoise(a, code, classIn, classChanged, p3, p4);
Error in ImageProcessingTool_App_2/pushbutton15_Callback (line 161)
noise=imnoise(a,'salt & pepper');
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.grayto8'.
Error in im2uint8 (line 66)
u = images.internal.builtins.grayto8(img);
Error in images.internal.changeClass (line 14)
image = im2uint8(varargin{:});
Error in images.internal.algimnoise (line 103)
b = images.internal.changeClass(classIn, b);
Error in imnoise (line 88)
b = images.internal.algimnoise(a, code, classIn, classChanged, p3, p4);
Error in ImageProcessingTool_App_2/pushbutton16_Callback (line 177)
noise=imnoise(a,'salt & pepper');
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.grayto8'.
Error in im2uint8 (line 66)
u = images.internal.builtins.grayto8(img);
Error in images.internal.changeClass (line 14)
image = im2uint8(varargin{:});
Error in images.internal.algimnoise (line 103)
b = images.internal.changeClass(classIn, b);
Error in imnoise (line 88)
b = images.internal.algimnoise(a, code, classIn, classChanged, p3, p4);
Error in ImageProcessingTool_App_2/pushbutton17_Callback (line 195)
noise=imnoise(a,'gaussian');
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.edgesobelprewitt'.
Error in edge (line 402)
[bx, by, b] = images.internal.builtins.edgesobelprewitt(a, isSobel, kx, ky);
Error in ImageProcessingTool_App_2/pushbutton18_Callback (line 212)
BW3=edge(I,'sobel');
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
Unable to resolve the name 'images.internal.builtins.imfilteripp'.
Error in imfilter>filterPartOrWhole (line 370)
result = images.internal.builtins.imfilteripp(a, outSize, h, nonzero_h,...
Error in imfilter (line 185)
b = filterPartOrWhole(a, finalSize, h, pad, sameSize, convMode);
Error in edge>smoothGradient (line 561)
GX = imfilter(I, gaussKernel', 'conv', 'replicate');
Error in edge (line 235)
[dx, dy] = smoothGradient(a, sigma);
Error in ImageProcessingTool_App_2/pushbutton19_Callback (line 229)
BW2=edge(I,'canny');
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
0 个评论
采纳的回答
Misa Taguchi
2023-2-14
Hi. I have run your code and realized a couple of things.
Import button
The error you posted seems to be derived from the wrong argument into the plot function, and if I commented out the line 252, it worked well. I was not sure what the line 252 tries to do, though.
Binary button
An error occurred in my environment in the line 281. I could modify the code like below adding the rgb2gray function before binarizing.
a = getappdata(0,'a');
gr = rgb2gray(a); % added
a_bw = imbinarize(gr,.57); % modified
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!