[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Display Image in MATLAB GUI

Posted on 2001-06-11
12
Medium Priority
?
9,734 Views
Last Modified: 2007-12-19
I created a GUI using the "guide" tool with MATLAB 6. How do I display an image within the GUI? Thanks.
0
Comment
Question by:streaks619
  • 7
  • 4
12 Comments
 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6178796
I know the answer. Let someone try out. I see many 'C' grades on your record.
0
 

Author Comment

by:streaks619
ID: 6190520
So - anybody have an answer?
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 6190797
Nope! Sorry...have never used Matlab....

Max.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6193956
OK...no one has answered this question till date. You might have figured out solution by this time. If not..try out these things...

You didn't mention whether you want image to be displayed at the start of the GUI program or after button press or mouse click on GUI.

In both cases the answer is same but with little variation.
I'm using MATLAB Version 5.3.0.10183.

(1) Display image on GUI as soon as GUI starts:

Then Better start GUI with image loading.

Use 'imread' and 'image' commands. See MATLAB help for options. The simplest way is:
at MATLAB prompt enter

a=imread('pnm.jpg');
image(a);

It will display image on figure. Then you invoke 'guide' and use mouse to adjust size. (figure must be in 'Controlled Mode'. Then save figure. Do whatever GUI stuff you want to do.


(2) Display image on GUI after button press.

'Add axes' from guide. Resize it as you wish. Add Button. Change caption using 'Property Editor' (String property). Selecting the button in figure - Use 'Callback Editor' from Guide. Select the appropriate action and add this code as a callback code.

a=imread('pnm1.jpg');
image(a);

To display image on mouse click you may select 'ButtonDownFcn'.

Feel free to get back to me if you have any doubt.

Best Regards,
PRASHANT.
0
 

Author Comment

by:streaks619
ID: 6194874
Let me give you the background for what I am doing -

I am creating a tracking program, where I am capturing consecutive video frames from a camera and then finding and following the moving people in the image.

I would like a GUI with two images: One is the original video frame. The second is a modified image with the individuals being tracked by some sort of dot or pointer.

Thus, each image needs to be constantly updated as more streaming data is processed.

0
 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6195152
What is the format of image?
0
 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6198265
streaks619  

I have already answered your original question. For the subsequent questions you are not providing me the additional information.

I'm not much familiar with video formats. You could have provided me the information and I would have tried it today. (Today is a holiday)

OK..all the very best...
0
 

Author Comment

by:streaks619
ID: 6198435
The format of the image can be anything I want it to be. The movie is in avi format, but the individual frames are just matrices of either (h x w) for black and white, or (h x w x 3) for color images.
0
 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6204329
Then images should not be a problem. Matlab supports many formats. Updating GUIs?...You can get handle of the original figure so You can use that handle.

Movies...ummn...
MATLAB comes with its own movie commands..Matlab's movies can only be played with MATLAB, they are generated slowly and consume enormous amounts of disk space when saved.

Does it support "avi" ? I have no idea. I do not have the latest version of MATLAB. Earlier version supports 'mpeg' and gif. (like animated gifs- using sequence of gifs)

0
 
LVL 4

Accepted Solution

by:
prashant_n_mhatre earned 800 total points
ID: 6208270
The command "lookfor avi" in my MATLAB yields the following functions:
AVIFINFO Text description of AVI-file contents.
AVIINFO Information about AVI file
AVIREAD Read AVI file.
movie2avi.m: %MOVIE2AVI(MOV,FILENAME) Create AVI movie from MATLAB movie
ADDFRAME  Add video frame to AVI file.
AVIFILE Create a new AVI file
CLOSE Finish writing and close AVI file.
DISPLAY Displays the AVIFILE object
GET Query AVIFILE properties
HORZCAT Horizontal concatenation of AVIFILE objects (disallowed)
SET Set properties of AVIFILE objects.
SUBSASGN subsasgn for an avifile object
SUBSREF subsref for a AVIFILE object
VERTCAT Vertical concatenation of AVIFILE objects (disallowed)
FINDCHUNK find chunk in AVI
FINDLIST find LIST in AVI
READAVI read frames from AVI file
SKIPCHUNK skip chunk in AVI
AVI write AVI file

It appears that there are plenty of functions that work with AVI files.  
0
 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6229143
any updates?
0
 

Author Comment

by:streaks619
ID: 7358298
I don't think any of this helped, but I'm gonna give you the points for trying...
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question