Sunday 22 March 2015

Browse and display image in MATLAB

First of all, excuse us for not posting any tutorial and videos on our you tube channel for such a long time.
Recently one of our subscriber posted a question regarding browsing opening files in hard drive of PC using MATLAB. So, our tea have developed a short video tutorial on browsing and displaying image using MATLAB GUI. You can check out our video on this link

.https://www.youtube.com/watch?v=9Ey-Ph4GEk8



But,in this post, we will be discussing the basic function which can be used for browsing files and extracting the name and path of the selected file. That means on proper execution of this function, user will get name of the selected file and location of the file in your hard drive.
These two parameters are more than enough to display or open file in MATLAB, in this post we will consider the example of opening image file,similar to video tutorial.

[FileName PathName]= uigetfile({'*. name of extension of file( example for image -.jpg,.png)'});

Name of extensions could be varied from .png to .xls or for all files only *.*
This function will only give output as name of file and location of the file which could be further used to open and display any file inn MATLAB environment. There is one special case with which all files will be displayed for browsing and selecting, sown below

[FileName PathName]= uigetfile({'*.*'});

Now , a basic example to browse, extract filename and path and reading the image file and also displaying the image in MATLAB environment.

[F P]=uigetfile({'*.jpg;*.png;*.tiff;*.bmp'}); // Here only 4 image file types are considered

image=imread([P F]);                        // Here filename i.e F and pathname i.e P are used to read image

imshow(image);                                // Display image

This simple code could be Incorporated in GUI to develop the GUI for browsing and displaying the image. For further understanding visit our youtube channel MATuino R for GUI development tutorial.



                             

Browse and display image in MATLAB

First of all, excuse us for not posting any tutorial and videos on our you tube channel for such a long time. Recently one of our subscrib...