PATTERN RECOGNITION LAB 8 TA : Nouf Al-Harbi::

Slides:



Advertisements
Similar presentations
Chapter 16 Graphical User Interfaces
Advertisements

Introduction to Macromedia Director 8.5 – Lingo
Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
Using Macros and Visual Basic for Applications (VBA) with Excel
DATA RETRIEVAL AND GUI CREATION DAVID COOPER SUMMER 2014.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
1 How to create GUI's in MatLAB Rigo Dicochea. 2 Introduction Graphical User Interface (GUI) MatLab provides Graphical User Interface Development Environment(GUIDE)
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
Writing GUI Applications An introduction with Java.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
SOLVING SUDOKU WITH MATLAB
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Programming a GUI Hanan sedaghat pisheh. For calling GUI, we need a function with no inputs or outputs First We create a m.file m file has the same name.
KJOlinski.com - RapidHMI INTRODUCING RapidHMI AND PLCExplorer.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Digital Image Processing Lecture 14: GUI using Matlab
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
A short intermission about function handles and cell arrays A MATLAB function may be referenced by a handle. >> sphere(100)
Introduction to the Graphical User Interface (GUI) in MATLAB
Matlab GUIs GUIDE.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Arc: AddIns Dr Andy Evans. Java Direct access to ArcObjects Framework inside and outside Arc. Ability to add components to the GUI. Ability to communicate.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
Introduction to Matlab & Data Analysis
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
Chapter 10 Fireworks: Part II The Web Warrior Guide to Web Design Technologies.
GUI development with Matlab: GUI Front Panel Components 1 GUI front panel components In this section, we will look at -GUI front panel components -Programming.
Creating a Logo – Lesson 3 1 Creating a Logo Lesson 3.
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
Classic Controls Trần Anh Tuấn A. Week 1 How to create a MFC project in VS 6.0 How to create a MFC project in VS 6.0 Introduction to Classic Controls.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Introduction to Matlab’s Graphical User Interface (GUI) Type “guide” “Guide” creates interface on a Figure window and code in an M-file. Some hidden code.
Graphical User Interfaces I The central station is the bubble gum planet with 280 pounds of clay and three head phone lines that come out and orbit the.
Introduction to MATLAB Damon Tomlin February 22, 2008 Lecture 3: Data Visualization & User Interfaces.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Chapter 2 – Introduction to the Visual Studio .NET IDE
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Introduction to Matlab & Data Analysis 2015 In this tutorial we will: Build a practical application using GUIDE Learn more about graphical user interface.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
Graphical Enablement In this presentation… –What is graphical enablement? –Introduction to newlook dialogs and tools used to graphical enable System i.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Building the Events Components– Lesson 111 Building the Events Components Lesson 11.
You Need an Interpreter!. Closing the GAP Thus far, we’ve been struggling to speak to computers in “their” language, maybe its time we spoke to them in.
GUI development with Matlab: GUI Front Panel Components GUI development with Matlab: Other GUI Components 1 Other GUI components In this section, we will.
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
The Hong Kong Polytechnic University Industrial Centre 1 MatLAB Lesson 9 : Introduction to GUI & Revision Edward Cheung Room W311g.
CS112 Scientific Computation Department of Computer Science Wellesley College Interactive Programs Graphical User Interfaces.
EGR 115 Introduction to Computing for Engineers
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
Graphical User Interfaces I The central station is the bubble gum planet with 280 pounds of clay and three head phone lines that come out and orbit the.
Lecture (7) Introduction to GUI Eng. Osama Talaat 1.
© 2010 Delmar, Cengage Learning Chapter 11 Creating and Using Templates.
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Graphical User Interfaces I
Graphical User Interface in MATLAB
Visual Basic Code & No.: CS 218
Looking at our “Getting Started” application
Chapter 2 – Introduction to the Visual Studio .NET IDE
An Introduction to Computers and Visual Basic
An Introduction to Computers and Visual Basic
More on Graphical User Interfaces
MATLAB GUI with GUIDE 報告人:張捷勝.
Embedding Graphics in Web Pages
An Introduction to Computers and Visual Basic
Electrical and Computer Engineering Department SUNY – New Paltz
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

PATTERN RECOGNITION LAB 8 TA : Nouf Al-Harbi::

Lab objective:  Dealing with GUI  Make Bayesian Classifier using GUI 2

3

Steps for making Bayesian classifier using GUI 4

Why use a GUI in MATLAB? 5  it makes things simple for the end-users of the program  If GUIs were not used, people would have to work from the command line interface  It can be extremely difficult and frustrating.

Steps for making Bayesian classifier using GUI 6  open up MATLAB  File  New  GUI

Final form we should have 7  8 Edit Text components  9 Static Text component  2 Pushbutton component  2 figures

Steps for making Bayesian classifier using GUI 8 Add in all these components to the GUI by clicking on the icon and placing it onto the grid

Steps for making Bayesian classifier using GUI 9  Its time to edit the properties of these components  Double click one of the components  You can also, Right-click the component and select property inspector

Steps for making Bayesian classifier using GUI 10  The Tag parameter is basically the variable name of this component  The String parameter is the text of this component

Steps for making Bayesian classifier using GUI 11  Now, save your GUI under any file name  When you save this file MATLAB automatically generates two files  myClassifier.fig file contains the graphics of your interface  myClassifier.m file contains all the code for the GUI

Steps for making Bayesian classifier using GUI 12  The.m file is where we attach the appropriate code to the callback of each component  we are primarily concerned only with the callback functions  You don’t have to worry about any of the other function types

What Is a Callback? 13  It is a function that you write and associate with a specific component in the GUI or with the GUI figure itself  It controls GUI or component behavior by performing some action in response to an event for its component  The event can be  a mouse click on a push button  menu selection  key press, etc.  There is a set of callbacks for each component and for the GUI figure itself.  For more information about callbacks you can visit this interested website

Steps for making Bayesian classifier using GUI 14  Open up the.m file  In the MATLAB editor, click on the icon,which will bring up a list of the functions within the.m  Select drawBtn_Callback.

Steps for making Bayesian classifier using GUI 15  Using handles  Handles is a structure that contains all components in a figure including figure itself.  Texts, pushbutton, axes, … etc.  We can’t access any component without using handles

Steps for making Bayesian classifier using GUI 16  There are many important functions :  Set Set a value for the component property  Get Get the value of the component property  Str2num Convert from string to number  Num2str Convert from number to string

Examples 17  To get the value of pw1_text string:  p1=get(handles.pw1_text,’string’);  To set 20 to Mu1 string:  set(handles.Mu1_text,’string’,20);  Exercise:  Set a value of Mu1 string to Mu2 string

guidata function 18  One of important function in gui  It updates the value of the component and keep that variable in our memory-workspace  That’s important to be used in other callback functions.  We can achieve it by doing this: guidata(h,handles)  Generally speaking, we need to finish every callback function with it.

Dealing with inputs 19  In each text callback we should write these instructions: handles.m1=get(handles.m1,’string’); guidata(h, handles);  Where m1 is a variabe we define to store mean value that the user enterd in m1 text box  In any callback we can use it as handles.m1

20 Classify button callback Function classifyBtn_Callback(hObject, eventdata, handles)  m1=str2num(get(handles.m1,'string'));  m2=str2num(get(handles.m2,'string'));  s1=str2num(get(handles.s1,'string'));  s2=str2num(get(handles.s2,'string'));  p1=str2num(get(handles.p1,'string'));  p2=str2num(get(handles.p2,'string'));  x=str2num(get(handles.pattern,'string'));  Pxw1=NormalFun(x,m1, s1);  Pxw2=NormalFun(x,m2, s2);  Pw1x=Pxw1*p1/((Pxw1*p1)+(Pxw2*p2));  Pw2x=Pxw2*p2/((Pxw1*p1)+(Pxw2*p2));  %Now make a decision using the posteriors;  if (Pw1x > Pw2x)  rslt = sprintf('%d belongs to w1', x);  set(handles.result,'string',rslt)  else  rslt = sprintf('%d belongs to w2', x);  set(handles.result,'string',rslt)  end

21 Draw button callback  m1=str2num(get(handles.m1,'string'));  m2=str2num(get(handles.m2,'string'));  s1=str2num(get(handles.s1,'string'));  s2=str2num(get(handles.s2,'string'));  p1=str2num(get(handles.p1,'string'));  p2=str2num(get(handles.p2,'string'));  x=str2num(get(handles.pattern,'string') );  x1Max=m1+(4*s1); x1Min=m1-(4*s1);  x2Max=m2+(4*s2); x2Min=m2-(4*s2);  xMax=max(x1Max,x2Max); xMin=min(x1Min,x2Min);  x=xMin:0.1:xMax;  n=length(x); pxw1=zeros(1,n); pxw2=zeros(1,n); pw1x=zeros(1,n); pw2x=zeros(1,n);  for i=1:n  pxw1(i)=NormalFun(x(i),m1, s1); pxw2(i)=NormalFun(x(i),m2, s2);  end  for i=1:n  pw1x(i)=pxw1(i)*p1/((pxw1(i)*p 1)+(pxw2(i)*p2));  pw2x(i)=pxw2(i)*p2/((pxw1(i)*p 1)+(pxw2(i)*p2));  end  axes(handles.axes1);  plot(x,pw1x,'r- ',x,pw2x,'b');  axes(handles.axes2);  plot(x,pxw1,'r- ',x,pxw2,'b'); Function DrawBtn_Callback(hObject, eventdata, handles)

Launching the GUI 22  There are two ways to launch your GUI  through the GUIDE editor press the icon on the GUIDE editor  from the MATLAB command prompt type in the name of the GUI at the command prompt you don’t need to type the.fig or.m extension

23

References 24  Materials of this lab are prepared using:   