-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatlab_GUI(1).m
More file actions
111 lines (90 loc) · 3.67 KB
/
Matlab_GUI(1).m
File metadata and controls
111 lines (90 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
classdef appim < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
UIAxes matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
SelectimageButton matlab.ui.control.Button
processimageButton matlab.ui.control.Button
UIAxes3 matlab.ui.control.UIAxes
B2WButton matlab.ui.control.Button
end
methods (Access = private)
% Button pushed function: SelectimageButton
function SelectimageButtonPushed(app, event)
global a;
[filename, pathname] = uigetfile('*.*', 'Pick an image');
filename=strcat(pathname,filename);
a=imread(filename);
imshow(a,'Parent',app.UIAxes);
end
% Button pushed function: processimageButton
function processimageButtonPushed(app, event)
global a;
j=a;
j=histeq(a);
imshow(j,'Parent',app.UIAxes2);
end
% Button pushed function: B2WButton
function B2WButtonPushed(app, event)
global a;
k=a;
k=rgb2gray(a);
imshow(k,'Parent',app.UIAxes3);
end
end
% App initialization and construction
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure
app.UIFigure = uifigure;
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'original ')
app.UIAxes.Position = [1 300 224 131];
% Create UIAxes2
app.UIAxes2 = uiaxes(app.UIFigure);
title(app.UIAxes2, 'after')
app.UIAxes2.Position = [214 300 214 131];
% Create SelectimageButton
app.SelectimageButton = uibutton(app.UIFigure, 'push');
app.SelectimageButton.ButtonPushedFcn = createCallbackFcn(app, @SelectimageButtonPushed, true);
app.SelectimageButton.Position = [37 138 100 22];
app.SelectimageButton.Text = 'Select image';
% Create processimageButton
app.processimageButton = uibutton(app.UIFigure, 'push');
app.processimageButton.ButtonPushedFcn = createCallbackFcn(app, @processimageButtonPushed, true);
app.processimageButton.Position = [271 146 100 22];
app.processimageButton.Text = 'process image';
% Create UIAxes3
app.UIAxes3 = uiaxes(app.UIFigure);
title(app.UIAxes3, 'b2w')
app.UIAxes3.Position = [427 294 225 137];
% Create B2WButton
app.B2WButton = uibutton(app.UIFigure, 'push');
app.B2WButton.ButtonPushedFcn = createCallbackFcn(app, @B2WButtonPushed, true);
app.B2WButton.Position = [490 146 100 22];
app.B2WButton.Text = 'B2W';
end
end
methods (Access = public)
% Construct app
function app = appim
% Create and configure components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end