Display Image in MATLAB GUI

I created a GUI using the "guide" tool with MATLAB 6. How do I display an image within the GUI? Thanks.
streaks619Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
prashant_n_mhatreConnect With a Mentor Commented:
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
 
prashant_n_mhatreCommented:
I know the answer. Let someone try out. I see many 'C' grades on your record.
0
 
streaks619Author Commented:
So - anybody have an answer?
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
DreamMasterCommented:
Nope! Sorry...have never used Matlab....

Max.
0
 
prashant_n_mhatreCommented:
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
 
streaks619Author Commented:
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
 
prashant_n_mhatreCommented:
What is the format of image?
0
 
prashant_n_mhatreCommented:
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
 
streaks619Author Commented:
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
 
prashant_n_mhatreCommented:
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
 
prashant_n_mhatreCommented:
any updates?
0
 
streaks619Author Commented:
I don't think any of this helped, but I'm gonna give you the points for trying...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.