Need some help with the MatLab GUI

2 views (last 30 days)
Ash
Ash on 25 Dec 2011
Hello,
I've an assignment and I need some help.
I'm trying to design a GUI that includes three buttons for three different compressing algorithms, and I need to import some test images from the GUI, I already have the algorithms written in Matlab (m-files), but how can I link the function with the button and how can I import an image and then compress it and preview it there; when I import an image it becomes two different matrices, one is the cdata and the other one is the colormap, i know i've to run the algorithms on the cdata, but how can i see the result
Sorry, I know I posted a long question but I need some help
Thanks ;)

Answers (3)

Naz
Naz on 25 Dec 2011
Since you already have your algorithms written, just create a new GUI and drug three buttons and one axis on the form. Automatically created .m file will contain all the code necessary to run the GUI. By clicking on each button in the gui editor, the callback functions (in the .m file) will be created for each respectively. Just paste your algorithm scripts into each corresponding callback function.
I don't completely understand your question. Assuming your algorithms are working, just put the code of each algorithm in the corresponding callback function. Since each algorithm will import the image, you dont really need to pass any parameters between other functions. Essential parameters such as handles are passed to the callback functions automatically: function pushbutton_callback(Object, handles...) or something like that. All necessary variables will be created within the callback function and dont need to be used outside that function (unless you are writing something more complicated). Of course, it is not the best way to write a program because every time you press a button the script will have to import the image, however it would be a good start to make sure each part of the script works properly. Later, you could create a separate function that will import the image, which could be used by all three algorithms instead of importing it three times. You could write this function in the main text or create another callback fucntion for a button that will be used to import image(s). In this case, your 'global' variables such as image data must be stored as handles.Yourvariable.
  2 Comments
Naz
Naz on 26 Dec 2011
see updated. Ask if you have more questions.

Sign in to comment.


Image Analyst
Image Analyst on 26 Dec 2011
Ash, you aren't "importing images from the GUI," you're reading images from the disk. So simply use imread to read your lena image in from disk to a variable in your program, then use imshow to display it in the current axes. If you want, you can see many examples of this in my tutorials/demos in my File Exchange:
<a>www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862</a>
  6 Comments
Walter Roberson
Walter Roberson on 27 Dec 2011
set(hObject,'String',num2str(MyValue))

Sign in to comment.


Ash
Ash on 26 Dec 2011
For you to have a look at the idea, i'm pasting the objectives: I've one of the two followings: 1-This assignment is to explore the median cut algorithm and color lookup tables (LUTs). The techniques that you will learn is the ability to read a color image (24 bits/pixel), manipulate the R, G, B data and display the resulting image on your computer screen. By the end of this assignment, you should be familiar with some basic image processing approaches using Matlab. 2-Please design a Graphical User Interface (GUI) to implement data compression algorithms in MATLAB.. These algorithms are divided into two main categories: · Lossless Compression (RLE ,Huffman ,LZW, Arithmetic coding) · Lossy Compression (JPEG) For lossy algorithms, find also Compression Performance (quality) using the following distortion measurements: MSE, SNR, PSNR Please test the JPEG scheme with different quality factors on the same image to see the results (Compression ratio, distortion measurements, and the resulting image)
Seriously guys, from scratch and three days and we're preparing for our finals
  1 Comment
Image Analyst
Image Analyst on 26 Dec 2011
OK. Doesn't look too bad. Maybe a couple of hours of work or so... at least for me ;-)

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!