Info

此问题已关闭。 请重新打开它进行编辑或回答。

How can I use pushbuttons in GUI to categorize a "like" or "dislike" of a image

1 次查看(过去 30 天)
I've been stuck on this problem and can't seem to find the right kind of tutorials online that would point me in the right direction.
My goal is to use a GUI that has two pushbuttons, a "like" and a "dislike" pushbutton.
I add the folder with all the images to my path so when my gui opens, the first image automatically pops up. Then I hit "like" or "dislike", and that information is saved as a logical corresponding to the image title in a structural array.
I've spent several hours working on creating practice GUI's that do other things to understand how everything works together, but I'm feeling in over my head maybe? Does anyone have any idea's, hints, or resources that they have in mind?

回答(1 个)

GT
GT 2018-12-15
Here is a very simple away around this... in the directory where you have the images try the following code:
im = imageDatastore(pwd); % creates imageDataStore with all the images
for i = 1:size(im.Files) % goes through each File
imshow(im.readimage(i)); % displays it)
answer = questdlg('Like/Dislike', ...
'Do you like', ...
'Like','Dislike','Like'); % prompts user for their opinion
mydata(i).file = im.Files(i);
% Handle response
switch answer
case 'Like'
mydata(i).like = 1;
case 'Dislike'
mydata(i).like = 0;
end
end
close all

Community Treasure Hunt

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

Start Hunting!

Translated by