Need some help with the MatLab GUI
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 ;)
0 commentaires
Réponses (3)
Naz
le 25 Déc 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 commentaires
Image Analyst
le 26 Déc 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 commentaires
Ash
le 26 Déc 2011
1 commentaire
Image Analyst
le 26 Déc 2011
OK. Doesn't look too bad. Maybe a couple of hours of work or so... at least for me ;-)
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!