image changing gui matlab
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I´d like to make a code that displays an image in a gui from a vector. I mean, I´ve got a vector that has the values 0,1,2 and I need to display in a gui an image depend on the value. I´ve got no idea to make this. Thank you.
2 Kommentare
Geoff Hayes
am 26 Mai 2020
What are the dimensions of your vector? How are these three numbers (or are there more?) mapped to colours?
Antworten (1)
Geoff Hayes
am 27 Mai 2020
So once you have created the salida array you need to determine which GUI action will invoke the process to display all the images one after the other. Let's assume that you have a pushbutton to do this. In the callback, you would place all of your code (that is right now in the OpeningFcn) to create the salida array, load the three images, and then cycle through each value in the array. Something like
image0 = imread('brazo22.jpg');
image1 = imread('brazo11.jpg');
image2 = imread('brazo33.jpg');
for k = 1:length(salida)
value = salida(k);
if value == 0 || value == 3
imshow(image0);
elseif value == 1
imshow(image1);
elseif value == 2
imshow(image2);
else
fprintf('error - invalid value: %d!\n', value)
end
pause(1.0); % <---- pause for one second
end
You can use a switch statement instead of the if/elseif if you'd rather. So we get the value of the kth element of the array, show the appropriate image (in the axes of your GUI), pause for one second (you can change this) and then move to the next element.
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!